flushbar
flushbar copied to clipboard
'package:flushbar/flushbar_route.dart': Failed assertion: line 308 pos 18: 'overlayEntries.isEmpty': is not true.
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.
════════════════════════════════════════════════════════════════════════════════
Having same issue. @liudonghua123 Have you got any solution?
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>)
════════════════════════════════════════════════════════════════════════════════════════════════════
@dimple3695 Hi, I did not find a solution, and finally I changed to another package https://pub.dev/packages/overlay_support.
same Problem here!
Same issue for me, seems to be working fine but the error is annoying
Same issue here. Works fine, but throws an error when Flushbar is hiding
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>)
I have same issue
Bye flushbar, hi overlay_support. https://pub.dev/packages/overlay_support
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 Thanks for the code snippet. It works! 😀😀
@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?
right. i will be making further development at https://github.com/cmdrootaccess/another-flushbar
please use another_flushbar: ^1.10.5 . same code just fixed this issue
Thank you for fixing the bug and publishing the fixed package @cmdrootaccess 😀
I solved for me Use overlay_support instead of flushbar https://pub.dev/packages/overlay_support
Same problem.
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 https://pub.dev/packages/another_flushbar
please use another_flushbar: ^1.10.5 . same code just fixed this issue
Awesome!
@vipinnegi90 https://pub.dev/packages/another_flushbar
oh, there is another flushbar called another_flushbar .. wow >.<
Any update on it?
Which is better, overlay support or another flushbar?
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?
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.
Bye flushbar, hi overlay_support. https://pub.dev/packages/overlay_support
and then what should i use instread of 'onStatusChanged' ??????
you can also use https://pub.dev/packages/awesome_extensions, with some extra feature and with extension, as well as null safety support.
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 ....
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!