flushbar icon indicating copy to clipboard operation
flushbar copied to clipboard

'package:flushbar/flushbar_route.dart': Failed assertion: line 308 pos 18: 'overlayEntries.isEmpty': is not true.

Open liudonghua123 opened this issue 3 years ago • 30 comments

Describe the bug

I just invoke the following code snippet in a onPressed callback of button.

                                  var flushbar = Flushbar(
                                    title: '操作结果',
                                    message: '${userDetail.username} 下线成功',
                                    backgroundColor: Colors.green,
                                    flushbarStyle: FlushbarStyle.GROUNDED,
                                    duration: Duration(seconds: 1),
                                  );
                                  await flushbar.show(context);

Paste relevant code

                            RaisedButton(
                              color: Colors.blue,
                              child: Text(
                                '下线',
                                style: defaultWhiteTextStyle,
                              ),
                              onPressed: () async {
                                var result = true;
                                if (result) {
                                  var flushbar = Flushbar(
                                    title: '操作结果',
                                    message: '${userDetail.username} 下线成功',
                                    backgroundColor: Colors.green,
                                    flushbarStyle: FlushbarStyle.GROUNDED,
                                    duration: Duration(seconds: 1),
                                  );
                                  await flushbar.show(context);
                                } else {
                                  Flushbar(
                                    title: '操作结果',
                                    message: '${userDetail.username} 下线失败',
                                    backgroundColor: Colors.red,
                                    flushbarStyle: FlushbarStyle.GROUNDED,
                                    duration: Duration(seconds: 1),
                                  )..show(context);
                                }
                              },
                            ),

More detailed logs

════════ Exception caught by animation library ═════════════════════════════════
The following assertion was thrown while notifying status listeners for AnimationController:
'package:flushbar/flushbar_route.dart': Failed assertion: line 308 pos 18: 'overlayEntries.isEmpty': is not true.

When the exception was thrown, this was the stack
#2      FlushbarRoute._handleStatusChanged
package:flushbar/flushbar_route.dart:308
#3      AnimationLocalStatusListenersMixin.notifyStatusListeners
package:flutter/…/animation/listener_helpers.dart:199
#4      AnimationController._checkStatusChanged
package:flutter/…/animation/animation_controller.dart:795
#5      AnimationController._tick
package:flutter/…/animation/animation_controller.dart:811
#6      Ticker._tick
package:flutter/…/scheduler/ticker.dart:238
...
The AnimationController notifying status listeners was: AnimationController#8dc1d(⏮ 0.000; paused; for FlushbarRoute<dynamic>)
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by animation library ═════════════════════════════════
'package:flushbar/flushbar_route.dart': Failed assertion: line 308 pos 18: 'overlayEntries.isEmpty': is not true.
════════════════════════════════════════════════════════════════════════════════

liudonghua123 avatar Nov 02 '20 17:11 liudonghua123

Having same issue. @liudonghua123 Have you got any solution?

dimple3695 avatar Nov 05 '20 09:11 dimple3695

Also with me. But snackbar is shown like it should.

                      FlushbarHelper.createError(
                        message: failure.map(
                          cancelledByUser: (_) => 'Cancelled',
                          serverError: (_) => 'Server error',
                          emailAlreadyInUse: (_) => 'Email already in use',
                          invalidEmailAndPasswordCombination: (_) =>
                              'Invalid email and password combination',
                        ),
                      ).show(context)
Results in:

════════ Exception caught by animation library ═════════════════════════════════════════════════════
The following assertion was thrown while notifying status listeners for AnimationController:
'package:flushbar/flushbar_route.dart': Failed assertion: line 308 pos 18: 'overlayEntries.isEmpty': is not true.

When the exception was thrown, this was the stack: 
#2      FlushbarRoute._handleStatusChanged (package:flushbar/flushbar_route.dart:308:18)
#3      AnimationLocalStatusListenersMixin.notifyStatusListeners (package:flutter/src/animation/listener_helpers.dart:199:19)
#4      AnimationController._checkStatusChanged (package:flutter/src/animation/animation_controller.dart:795:7)
#5      AnimationController._tick (package:flutter/src/animation/animation_controller.dart:811:5)
#6      Ticker._tick (package:flutter/src/scheduler/ticker.dart:238:12)
...
The AnimationController notifying status listeners was: AnimationController#82bcc(⏮ 0.000; paused; for FlushbarRoute<dynamic>)
════════════════════════════════════════════════════════════════════════════════════════════════════

rokk4 avatar Nov 10 '20 15:11 rokk4

@dimple3695 Hi, I did not find a solution, and finally I changed to another package https://pub.dev/packages/overlay_support.

liudonghua123 avatar Nov 11 '20 01:11 liudonghua123

same Problem here!

Zony-Zhao avatar Nov 13 '20 15:11 Zony-Zhao

Same issue for me, seems to be working fine but the error is annoying

Ferdzzzzzzzz avatar Nov 30 '20 07:11 Ferdzzzzzzzz

Same issue here. Works fine, but throws an error when Flushbar is hiding

wojtekoziol avatar Nov 30 '20 10:11 wojtekoziol

I have the same issue. Works fine until the Flushbar is closed.

The following assertion was thrown while notifying status listeners for AnimationController:
'package:flushbar/flushbar_route.dart': Failed assertion: line 308 pos 18: 'overlayEntries.isEmpty': is not true.

When the exception was thrown, this was the stack: 
#2      FlushbarRoute._handleStatusChanged (package:flushbar/flushbar_route.dart:308:18)
#3      AnimationLocalStatusListenersMixin.notifyStatusListeners (package:flutter/src/animation/listener_helpers.dart:199:19)
#4      AnimationController._checkStatusChanged (package:flutter/src/animation/animation_controller.dart:795:7)
#5      AnimationController._tick (package:flutter/src/animation/animation_controller.dart:811:5)
#6      Ticker._tick (package:flutter/src/scheduler/ticker.dart:238:12)
...
The AnimationController notifying status listeners was: AnimationController#abf7a(⏮ 0.000; paused; for FlushbarRoute<dynamic>)

devj3ns avatar Dec 03 '20 14:12 devj3ns

I have same issue

otopba avatar Dec 03 '20 19:12 otopba

Bye flushbar, hi overlay_support. https://pub.dev/packages/overlay_support

Epistemoloji avatar Dec 04 '20 11:12 Epistemoloji

Clone the code and insert this line

if(overlayEntries.isNotEmpty){
       overlayEntries.clear();
}
  assert(overlayEntries.isEmpty);

at

https://github.com/AndreHaueisen/flushbar/blob/master/lib/flushbar_route.dart#L307

cmdrootaccess avatar Dec 05 '20 15:12 cmdrootaccess

@cmdrootaccess Thanks for the code snippet. It works! 😀😀

devj3ns avatar Dec 05 '20 19:12 devj3ns

@cmdrootaccess Would you mind to open a pull request? Although if I see the activity of the package owner I dont think it will merged right?

Vinzent03 avatar Dec 05 '20 20:12 Vinzent03

right. i will be making further development at https://github.com/cmdrootaccess/another-flushbar

cmdrootaccess avatar Dec 06 '20 15:12 cmdrootaccess

please use another_flushbar: ^1.10.5 . same code just fixed this issue

cmdrootaccess avatar Dec 06 '20 16:12 cmdrootaccess

Thank you for fixing the bug and publishing the fixed package @cmdrootaccess 😀

devj3ns avatar Dec 06 '20 17:12 devj3ns

I solved for me Use overlay_support instead of flushbar https://pub.dev/packages/overlay_support

serkanayaz avatar Dec 20 '20 21:12 serkanayaz

Same problem.

edufolly avatar Jan 08 '21 21:01 edufolly

please use another_flushbar: ^1.10.5 . same code just fixed this issue

where is it published? I still see 1.10.4 in pub.dev.

vipinnegi90 avatar Mar 08 '21 02:03 vipinnegi90

@vipinnegi90 https://pub.dev/packages/another_flushbar

cmdrootaccess avatar Mar 08 '21 09:03 cmdrootaccess

please use another_flushbar: ^1.10.5 . same code just fixed this issue

Awesome!

jonasN5 avatar Mar 23 '21 12:03 jonasN5

@vipinnegi90 https://pub.dev/packages/another_flushbar

oh, there is another flushbar called another_flushbar .. wow >.<

vipinnegi90 avatar Mar 23 '21 14:03 vipinnegi90

Any update on it?

IvanPavliuk avatar Mar 25 '21 09:03 IvanPavliuk

Which is better, overlay support or another flushbar?

mellowcello77 avatar Mar 27 '21 10:03 mellowcello77

I replaced it with another_flushbar. I had to change the import, but the other parts inherited the flushbar settings, so there were few parameter modifications.

Which is better, overlay support or another flushbar?

mcz9mm avatar Apr 25 '21 04:04 mcz9mm

please use another_flushbar: ^1.10.5 . same code just fixed this issue

thanks, it works fine. i use same code as like before, just change dependency and borderRadius behavior.

fuadrivai avatar May 31 '21 02:05 fuadrivai

Bye flushbar, hi overlay_support. https://pub.dev/packages/overlay_support

and then what should i use instread of 'onStatusChanged' ??????

YawarOsman avatar Aug 02 '21 12:08 YawarOsman

you can also use https://pub.dev/packages/awesome_extensions, with some extra feature and with extension, as well as null safety support.

jayeshpansheriya avatar Dec 05 '21 06:12 jayeshpansheriya

Clone the code and insert this line

if(overlayEntries.isNotEmpty){
       overlayEntries.clear();
}
  assert(overlayEntries.isEmpty);

at

https://github.com/AndreHaueisen/flushbar/blob/master/lib/flushbar_route.dart#L307

it works ....

Nishorecolan avatar Jun 08 '22 11:06 Nishorecolan

I have the same issue here, I couldn't solve it, I had to move to another library called another_flushbar, I previously had an issue with unsound-null-safety!

Hamza-ye avatar Jul 09 '22 19:07 Hamza-ye