another-flushbar icon indicating copy to clipboard operation
another-flushbar copied to clipboard

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

Open davidfranquet opened this issue 2 years ago • 19 comments

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.<anonymous closure> (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.<anonymous closure> (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.<anonymous closure> (dart:async/zone.dart:1260:23) #16 Timer._createTimer.<anonymous closure> (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)

davidfranquet avatar Mar 02 '22 15:03 davidfranquet

Same here!

alexaniko88 avatar Mar 02 '22 15:03 alexaniko88

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

walsha2 avatar Mar 11 '22 08:03 walsha2

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

juliansteenbakker avatar Mar 15 '22 11:03 juliansteenbakker

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

alexaniko88 avatar Mar 15 '22 11:03 alexaniko88

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.

juliansteenbakker avatar Mar 15 '22 11:03 juliansteenbakker

Any update on this?

hwennnn avatar Apr 27 '22 13:04 hwennnn

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.

danken00 avatar May 08 '22 09:05 danken00

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 :

  • Register a listener on some event that will display the flushbar while the app is in background (not shown)
  • Put the app in the background
  • Trigger the event that will make the listener display the flushbar (e.g. a connectivity change)
  • Wait for the end of timer duration
  • The exception is thrown

orevial avatar May 31 '22 15:05 orevial

any updates?

kuba-asanov avatar Sep 15 '22 10:09 kuba-asanov

any fix or workaround? @orevial

Davete0302 avatar Nov 03 '22 07:11 Davete0302

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.

mstich-mcmservices avatar Nov 24 '22 13:11 mstich-mcmservices

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

ercantomac avatar Feb 02 '23 08:02 ercantomac

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 avatar Feb 03 '23 17:02 nicolobozzato

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

nicolobozzato avatar Feb 14 '23 09:02 nicolobozzato

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

JPLeoRX avatar Mar 23 '23 14:03 JPLeoRX

I also have this issue

moloti avatar Mar 24 '23 11:03 moloti

This issue is still occurring and crashing my app.

reynirf avatar Nov 29 '23 10:11 reynirf

Same here!

DevTiago avatar Mar 22 '24 01:03 DevTiago

same issue

hodfords-khai-mobile avatar Apr 24 '24 02:04 hodfords-khai-mobile