Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flushbar throws error when we swipe from left to right to go back on ios. #17

Closed
withmukeshjoshi opened this issue Nov 5, 2018 · 32 comments
Labels
enhancement New feature or request priority This issue is a priority and is currently being worked on

Comments

@withmukeshjoshi
Copy link

if we try to go back via swiping on ios when flushbar is showing toast. it will go back in navigator and flush notification will remain at their positon.

@AndreHaueisen
Copy link
Owner

Hi @orangewp
Can you paste your code here, please?

@withmukeshjoshi
Copy link
Author

hii after a lot of trying, I decided not to use the plugin in my app. Maybe I can reuse it to create the issue.

basically what I am doing is,

Popping up flushbar whenever app gets OnMessage() FCM notification.

in android I didnt notice any issue because of the back button but in IOS the swipe from left edge to right edge (which is common to go back) crashes the app.

@AndreHaueisen
Copy link
Owner

Sorry to hear that @orangewp
Unfortunately, I can not debug it on IOS since I do not own a MAC (it is too expensive in Brazil).
I will try to borrow one, but for now, I welcome PRs with possible solutions.

Do not know if this helps, but Flushbar pushes a route on top of the stack. Try dismissing Flushbar before going back.

In any case, thanks for your interest.

@withmukeshjoshi
Copy link
Author

I really like your plugin. even if I am unable to use it.
the thing is the main stateful widget is pushing the flushbar popup, I cannot control it when I am deep down to another stateful widget.

I am not expert in the flutter/dart.

@VadymPinchuk
Copy link

Actually same issue is on Android ) so it can be checked. please take a look on that.
E/flutter (30885): 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1554 pos 12: '!_debugLocked': is not true. E/flutter (30885): #0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39) E/flutter (30885): #1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5) E/flutter (30885): #2 NavigatorState.push (package:flutter/src/widgets/navigator.dart:1554:12) E/flutter (30885): #3 Flushbar.show (package:flushbar/flushbar.dart:383:62) E/flutter (30885): <asynchronous suspension> E/flutter (30885): #4 HomePage.build.<anonymous closure> (package:flutter_flushbar/main.dart:97:23) E/flutter (30885): #5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14) E/flutter (30885): #6 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30) E/flutter (30885): #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24) E/flutter (30885): #8 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9) E/flutter (30885): #9 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7) E/flutter (30885): #10 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9) E/flutter (30885): #11 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12) E/flutter (30885): #12 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11) E/flutter (30885): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:180:19) E/flutter (30885): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22) E/flutter (30885): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7) E/flutter (30885): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7) E/flutter (30885): #17 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7) E/flutter (30885): #18 _invoke1 (dart:ui/hooks.dart:168:13) E/flutter (30885): #19 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)

@AndreHaueisen
Copy link
Owner

@I-am-original Thanks for reporting. Could you paste relevant code, please? Or share a link to your code. This could help me reproduce the error

@AndreHaueisen
Copy link
Owner

No need. I was able to reproduce it. Working on the solution.

@AndreHaueisen
Copy link
Owner

@I-am-original version 1.1.1 was released. Please, let me know if the problem was solved.

@withmukeshjoshi
Copy link
Author

did it fixed my issue as well?

@VadymPinchuk
Copy link

@AndreHaueisen yes I have seen that. But have not checked. @orangewp it should fix issue with Navigator. Actually there where only one crash )

@withmukeshjoshi
Copy link
Author

this is the error I am getting on ios when swiping.

flutter: ══╡ EXCEPTION CAUGHT BY ANIMATION LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown while notifying status listeners for AnimationController:
flutter: Cannot reuse a MaterialPageRoute after disposing it.
flutter: 'package:flutter/src/widgets/routes.dart': Failed assertion: line 218 pos 12:
flutter: '!_transitionCompleter.isCompleted'
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter: https://github.com/flutter/flutter/issues/new
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 TransitionRoute.didPopNext (package:flutter/src/widgets/routes.dart:218:12)
flutter: #3 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:1792:23)
flutter: #4 _CupertinoBackGestureController._handleStatusChanged (package:flutter/src/cupertino/route.dart:610:17)
flutter: #5 _AnimationController&Animation&AnimationEagerListenerMixin&AnimationLocalListenersMixin&AnimationLocalStatusListenersMixin.notifyStatusListeners (package:flutter/src/animation/listener_helpers.dart:161:19)
flutter: #6 AnimationController._checkStatusChanged (package:flutter/src/animation/animation_controller.dart:678:7)
flutter: #7 AnimationController._tick (package:flutter/src/animation/animation_controller.dart:694:5)
flutter: #8 Ticker._tick (package:flutter/src/scheduler/ticker.dart:228:5)
flutter: #9 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
flutter: #10 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame. (package:flutter/src/scheduler/binding.dart:906:11)
flutter: #11 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection/runtime/libcompact_hash.dart:370:8)
flutter: #12 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:904:17)
flutter: #13 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:834:5)
flutter: #14 _invoke1 (dart:ui/hooks.dart:153:13)
flutter: #15 _beginFrame (dart:ui/hooks.dart:123:3)
flutter: (elided 2 frames from class _AssertionError)
flutter:
flutter: The AnimationController notifying status listeners was:
flutter: AnimationController#8a450(⏮ 0.000; paused; DISPOSED; for MaterialPageRoute(null))
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════

@withmukeshjoshi
Copy link
Author

the the widget showing the flushbar is stacked and I am in deep down widget.

@AndreHaueisen
Copy link
Owner

This error happens when you try to reuse a dismissed Flushbar. An instance can be used only one time.
That being said, it is hard for me to diagnose the problem without the code.
@orangewp , it looks like you and @I-am-original are having different problems after all.

@withmukeshjoshi
Copy link
Author

it is happenning when I am popping back but after duration ends it tried to close the flushbar

@withmukeshjoshi
Copy link
Author

lets say i set duration 10 seconds and I pop back after flushbar shows.
when 10 seconds ends, it throws error.

@AndreHaueisen
Copy link
Owner

Ohh that helps a lot. The timer is not getting properly canceled. Thanks! I will try to solve it asap

@withmukeshjoshi
Copy link
Author

sorry I was thinking more and I realised that you also set flushbar in a way that it automatically gets dismissed when navigator push or pop..
so
when push, it is working as expected but in pop, it is throwing the error because it might be trying to dismiss the flush after popping up

@withmukeshjoshi
Copy link
Author

I double checked. Timer has nothing to do. The pop is throwing the error immediately.

@withmukeshjoshi
Copy link
Author

only when popping by swiping in ios. If we press the back button in ios it is closing the flush on first tab and popping on second tap. means if flush is showing, then it takes two back button taps to go back. but in ios people usually use swipe to go back.

@withmukeshjoshi
Copy link
Author

this is my observation. I hope it helps :)

@01xJoao
Copy link

01xJoao commented Feb 11, 2019

I'm having the same issue, any fix for this?

@AndreHaueisen
Copy link
Owner

@joaowd I had to buy a MAC to test my apps (hate Apple expensive products)
Will begin debugging it as soon as it arrives.

@01xJoao
Copy link

01xJoao commented Feb 11, 2019

@joaowd I had to buy a MAC to test my apps (hate Apple expensive products)
Will begin debugging it as soon as it arrives.

Thats great news, they are expensive but they are really good, you will love it :)

(I'm getting this exception on the both branches I tested (dev and master))

Exception Message:

flutter: ══╡ EXCEPTION CAUGHT BY ANIMATION LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown while notifying status listeners for AnimationController:
flutter: Cannot reuse a MaterialPageRoute<dynamic> after disposing it.
flutter: 'package:flutter/src/widgets/routes.dart': Failed assertion: line 218 pos 12:
flutter: '!_transitionCompleter.isCompleted'
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2      TransitionRoute.didPopNext 
package:flutter/…/widgets/routes.dart:218
flutter: #3      NavigatorState.pop 
package:flutter/…/widgets/navigator.dart:1833
flutter: #4      _CupertinoBackGestureController._handleStatusChanged 
package:flutter/…/cupertino/route.dart:653
flutter: #5      _AnimationController&Animation&AnimationEagerListenerMixin&AnimationLocalListenersMixin&AnimationLocalStatusListenersMixin.notifyStatusListeners 
package:flutter/…/animation/listener_helpers.dart:192
flutter: #6      AnimationController._checkStatusChanged 
package:flutter/…/animation/animation_controller.dart:736
flutter: #7      AnimationController._tick 
package:flutter/…/animation/animation_controller.dart:752
flutter: #8      Ticker._tick 
package:flutter/…/scheduler/ticker.dart:228
flutter: #9      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback 
package:flutter/…/scheduler/binding.dart:990
flutter: #10     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame.<anonymous closure> 
package:flutter/…/scheduler/binding.dart:906
flutter: #11     __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection/runtime/libcompact_hash.dart:367:8)
flutter: #12     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame 
package:flutter/…/scheduler/binding.dart:904
flutter: #13     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleBeginFrame 
package:flutter/…/scheduler/binding.dart:834
flutter: #17     _invoke1 (dart:ui/hooks.dart:203:10)
flutter: #18     _beginFrame (dart:ui/hooks.dart:156:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter:
flutter: The AnimationController notifying status listeners was:
flutter:   AnimationController#1b6d1(⏮ 0.000; paused; DISPOSED; for MaterialPageRoute<dynamic>(null))

@AndreHaueisen
Copy link
Owner

Trying to find a solution with the flutter team

@01xJoao
Copy link

01xJoao commented Mar 2, 2019

Since you use context to pop the bar, I don't think there is a solution.

I'm using this package https://pub.dartlang.org/packages/overlay_support

@AndreHaueisen
Copy link
Owner

Context has nothing to do with it. This package also requires context to push the notification.

@AndreHaueisen
Copy link
Owner

Just released a new feature that offers a temporary workaround. Use FlushbarPosition.TOP with FlushbarStyle.GROUNDED so the user will have to dismiss the notification first before being able to do the "swipe to go back" gesture

@AndreHaueisen
Copy link
Owner

This issue was fixed on Flutter master channel.
To use it, type the command in the terminal flutter channel master.
This should eventually come to the stable channel.

@AndreHaueisen AndreHaueisen added fixed on master This issue is solved on the flutter master channel and removed help wanted labels Mar 6, 2019
@AndreHaueisen
Copy link
Owner

Leaving it open while this does not hit stable to inform new users.

@AndreHaueisen AndreHaueisen reopened this Mar 6, 2019
@AndreHaueisen
Copy link
Owner

See issue

@AndreHaueisen AndreHaueisen added enhancement New feature or request priority This issue is a priority and is currently being worked on and removed fixed on master This issue is solved on the flutter master channel labels Jun 1, 2019
@ricpar11
Copy link

It's a shame that this issue has not been solved yet, I love this library but this forces me to look for alternatives 😭

@AndreHaueisen
Copy link
Owner

This issue was moved to
#104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority This issue is a priority and is currently being worked on
Projects
None yet
Development

No branches or pull requests

5 participants