cmdrootaccess / another-flushbar

A flexible widget for user notification. Customize your text, button, duration, animations and much more. For Android devs, it is made to replace Snackbars and Toasts.
https://pub.dev/packages/another_flushbar
MIT License
145 stars 89 forks source link

FlushBar error on Flutter 2.10.2 'entry.currentState == _RouteLifecicle.popping......' #58

Open davidfranquet opened 2 years ago

davidfranquet commented 2 years ago

Flushbar is crashing on Flutter 2.10.+

Here is the log:

`Failed assertion: line 5021 pos 12: 'entry.currentState == _RouteLifecycle.popping || (entry.hasPage && entry.currentState.index < _RouteLifecycle.pop.index)': is not true. flutter: #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)

1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)

2 NavigatorState.finalizeRoute (package:flutter/src/widgets/navigator.dart:5021:12)

3 OverlayRoute.didPop (package:flutter/src/widgets/routes.dart:74:18)

4 FlushbarRoute.didPop (package:another_flushbar/flushbar_route.dart:393:18)

5 _RouteEntry.handlePop (package:flutter/src/widgets/navigator.dart:2896:16)

6 NavigatorState._flushHistoryUpdates (package:flutter/src/widgets/navigator.dart:3860:22)

7 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:4902:7)

8 FlushbarRoute._configureTimer. (package:another_flushbar/flushbar_route.dart:403:22)

9 _rootRun (dart:async/zone.dart:1418:47)

10 _CustomZone.run (dart:async/zone.dart:1328:19)

11 _CustomZone.runGuarded (dart:async/zone.dart:1236:7)

12 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1276:23)

13 _rootRun (dart:async/zone.dart:1426:13)

14 _CustomZone.run (dart:async/zone.dart:1328:19)

15 _CustomZone.bindCallback. (dart:async/zone.dart:1260:23)

16 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)

17 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)

18 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)

19 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

`

alexaniko88 commented 2 years ago

Same here!

walsha2 commented 2 years ago

Also getting this issue... not sure what is going on or how to resolve it.

juliansteenbakker commented 2 years ago

This is a bug in Flutter https://github.com/flutter/flutter/issues/98224

alexaniko88 commented 2 years ago

Not really, as they say: The Route.didPop is not meant to be called directly, you should use Navigator.pop instead

juliansteenbakker commented 2 years ago

Yes and further:

The removed route is removed without being completed, so this method does not take a return value argument. The places where I am using didPop to close a route are passing values back to the widget which displayed them. If there is a way of doing that, please let me know.

Also, the Route.didPop thats implemented in FlushbarRoute is an extended class of OverlayRoute, which is part of the Flutter framework and also uses Route.didPop, so the error is part of the Flutter Framework and not this package.

hwennnn commented 2 years ago

Any update on this?

danken00 commented 2 years ago

Happening for me too. I'm also a bit confused as to why FlushBar is doing anything with Routes in the first place... what's the relationship? But yes, it's crashing everything; commenting out the FlushBar causes the issue to go away.

orevial commented 2 years ago

I have the same issue on Flutter 2.10.5 but in my case it's only happening when the flushbar is started while the app is in background.

Basically I have a BLoC listener that triggers a flushbar on some events (e.g. connectivity change). When the flushbar is started there is no problem but when the flushbar is dismissed I get the above exception when it was started in background.

Steps to reproduce :

kuba-asanov commented 1 year ago

any updates?

Davete0302 commented 1 year ago

any fix or workaround? @orevial

mstich-mcmservices commented 1 year ago

Ran into the same issue which, for me, renders this package unusable. I would love to have the time to dive in and get to the cause, but I do not and had to move on without using this library. Shame because I do appreciate it's function.

ercantomac commented 1 year ago

Any updates on this? It's a pretty serious issue

nicolobozzato commented 1 year ago

Don't know if it's your problem and can help you, but I found it happens when you pop a route after call show on a flushbar. So you can either await for it to finish and then pop, or also wrap it in a Future.delayed(Duration.zero, (){ });

works, so it schedules it right after the pop and doesn't try to pop the flushbar WHILE you are popping the route giving the error.

nicolobozzato commented 1 year ago

I regret to inform you that my solution with Future.delayed still doesn't resolve the issue in some instances

JPLeoRX commented 1 year ago

Encountered this issue too, are there any updates or workarounds? This is a quite severe issue in an otherwise perfect library.

moloti commented 1 year ago

I also have this issue

reynirf commented 9 months ago

This issue is still occurring and crashing my app.

DevTiago commented 5 months ago

Same here!

hodfords-khai-mobile commented 4 months ago

same issue