UIFreeze: Tried to remove a willPop callback from a route that is not currently in the tree.
I noticed that, after i call this:
context.showSuccessBar(content: Text('Authentication verified!'));
It is displaying properly on the UI, but on the log, i can see this trace. And during that, my UI is freezen, i have to restart my app to use my app. Why is that?
======== Exception caught by animation library =====================================================
The following assertion was thrown while notifying status listeners for AnimationController:
Tried to remove a willPop callback from a route that is not currently in the tree.
'package:flutter/src/widgets/routes.dart':
Failed assertion: line 1508 pos 12: '_scopeKey.currentState != null'
When the exception was thrown, this was the stack:
#2 ModalRoute.removeScopedWillPopCallback (package:flutter/src/widgets/routes.dart:1508:12)
#3 FlashController.dismissInternal (package:flash/flash.dart:224:35)
#4 FlashController.dispose (package:flash/flash.dart:244:5)
#5 FlashController._handleStatusChanged (package:flash/flash.dart:159:9)
#6 AnimationLocalStatusListenersMixin.notifyStatusListeners (package:flutter/src/animation/listener_helpers.dart:233:19)
#7 AnimationController._checkStatusChanged (package:flutter/src/animation/animation_controller.dart:815:7)
#8 AnimationController._tick (package:flutter/src/animation/animation_controller.dart:831:5)
#9 Ticker._tick (package:flutter/src/scheduler/ticker.dart:238:12)
#10 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146:15)
#11 SchedulerBinding.handleBeginFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1059:11)
#12 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:614:13)
#13 SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:1057:17)
#14 SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:976:5)
#18 _invoke1 (dart:ui/hooks.dart:170:10)
#19 PlatformDispatcher._beginFrame (dart:ui/platform_dispatcher.dart:286:5)
#20 _beginFrame (dart:ui/hooks.dart:104:31)
(elided 5 frames from class _AssertionError and dart:async)
The AnimationController notifying status listeners was: AnimationController#a3606(⏮ 0.000; paused; for FlashController<dynamic>)
@anburocky3 I can't reproduce it. Can you show your code and environment or provide an example?
Sorry, i have it in my project, is there any way, i can contact you via discord, to share the credentials?
Sorry, i have it in my project, is there any way, i can contact you via discord, to share the credentials?
I'm facing the same issue either. In my case, it's because I called a Navigator Pop. so the BuildContext are not in the Stack anymore. So I tricked it with Future.delayed before navigator pop called.
Facing the same issue.
Facing the same issue.
You can try my solution above. It's not elegant solution, because delayed pretty much expensive task, but it works. I think the problem is, there is a async delay beetwen disposing Flash dan the Navigator.pop that makes current BuildContext already disposed and throw this error.
you need create the another completer for handle race condition.
var completer = Completer();
var completerFinishDialog = Completer();
context.showSuccessBar(content: Text('Authentication verified!')).then((_) => completerFinishDialog.complate());
completer.complate();
await completer.future;
await completerFinishDialog .future;
/// Navigator.pop() or replace