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

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

Open
liudonghua123 opened this issue Nov 2, 2020 · 30 comments

Comments

@liudonghua123
Copy link

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.
════════════════════════════════════════════════════════════════════════════════
@dimple3695
Copy link

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

@rokk4
Copy link

rokk4 commented Nov 10, 2020

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>)
════════════════════════════════════════════════════════════════════════════════════════════════════

@liudonghua123
Copy link
Author

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

@Zony-Zhao
Copy link

same Problem here!

@fsteenkamp
Copy link

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

@wojtekoziol
Copy link

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

@devj3ns
Copy link

devj3ns commented Dec 3, 2020

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>)

@otopba
Copy link

otopba commented Dec 3, 2020

I have same issue

@ghost
Copy link

ghost commented Dec 4, 2020

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

@cmdrootaccess
Copy link

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

@devj3ns
Copy link

devj3ns commented Dec 5, 2020

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

@Vinzent03
Copy link

@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?

@cmdrootaccess
Copy link

cmdrootaccess commented Dec 6, 2020

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

@cmdrootaccess
Copy link

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

@devj3ns
Copy link

devj3ns commented Dec 6, 2020

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

@serkanayaz
Copy link

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

@edufolly
Copy link

edufolly commented Jan 8, 2021

Same problem.

@vipinnegi90
Copy link

vipinnegi90 commented Mar 8, 2021

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.

@cmdrootaccess
Copy link

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

@jonasN5
Copy link

jonasN5 commented Mar 23, 2021

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

Awesome!

@vipinnegi90
Copy link

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

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

@IvanPavliuk
Copy link

Any update on it?

@mellowcello77
Copy link

Which is better, overlay support or another flushbar?

@mcz9mm
Copy link

mcz9mm commented Apr 25, 2021

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?

@fuadrivai
Copy link

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.

@YawarOsman
Copy link

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

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

@jayeshpansheriya
Copy link

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

@Nishore-Dev
Copy link

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 ....

@Hamza-ye
Copy link

Hamza-ye commented Jul 9, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests