Repository navigation
Cannot reuse a MaterialPageRoute<dynamic> after disposing it. #27334
Copy link
Copy link
Closed
Labels
c: contributor-productivityTeam-specific productivity, code health, technical debt.Team-specific productivity, code health, technical debt.c: crashStack traces logged to the consoleStack traces logged to the consolec: flakeTests that sometimes, but not always, incorrectly passTests that sometimes, but not always, incorrectly passcustomer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.Relating to flutter/gallery repository. Please transfer non-framework issues there.f: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: cupertino_uicupertino_ui package in flutter/packagescupertino_ui package in flutter/packages
Description
Steps to Reproduce
Video: https://i.imgur.com/A85IETe.mp4
- Install Flutter Gallery on iOS simulator
- Open and close any sample using the swipe mechanism
- After a few successful swipes pick up the pace of opening and closing the sample
- Crashes
Logs
flutter: ══╡ EXCEPTION CAUGHT BY ANIMATION LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown while notifying status listeners for AnimationController:
flutter: Cannot reuse a MaterialPageRoute<dynamic> after disposing it.
flutter: 'package:flutter/src/widgets/routes.dart': Failed assertion: line 218 pos 12:
flutter: '!_transitionCompleter.isCompleted'
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter: https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 TransitionRoute.didPopNext (package:flutter/src/widgets/routes.dart:218:12)
flutter: #3 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:1944:23)
flutter: #4 _CupertinoBackGestureController._handleStatusChanged (package:flutter/src/cupertino/route.dart:651:17)
flutter: #5 _AnimationController&Animation&AnimationEagerListenerMixin&AnimationLocalListenersMixin&AnimationLocalStatusListenersMixin.notifyStatusListeners (package:flutter/src/animation/listener_helpers.dart:192:19)
flutter: #6 AnimationController._checkStatusChanged (package:flutter/src/animation/animation_controller.dart:736:7)
flutter: #7 AnimationController._tick (package:flutter/src/animation/animation_controller.dart:752:5)
flutter: #8 Ticker._tick (package:flutter/src/scheduler/ticker.dart:228:5)
flutter: #9 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
flutter: #10 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:906:11)
flutter: #11 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection/runtime/libcompact_hash.dart:367:8)
flutter: #12 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:904:17)
flutter: #13 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:834:5)
flutter: #17 _invoke1 (dart:ui/hooks.dart:203:10)
flutter: #18 _beginFrame (dart:ui/hooks.dart:156:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter:
flutter: The AnimationController notifying status listeners was:
flutter: AnimationController#f0974(⏮ 0.000; paused; DISPOSED; for
flutter: MaterialPageRoute<dynamic>(/cupertino/alert))
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 1507 pos 12: '!_debugLocked': is not true.
Analyzing flutter_gallery...
No issues found! (ran in 5.6s)
[✓] Flutter (Channel master, v1.2.1-pre.50, on Mac OS X 10.14.2, locale en-US)
• Flutter version 1.2.1-pre.50 at /Users/droidery/flutter
• Framework revision dbd1b317ff (76 minutes ago), 2019-01-30 21:31:44 -0500
• Engine revision 15f2b92cce
• Dart version 2.1.1 (build 2.1.1-dev.3.2 71bee8f05e)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/droidery/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 1.9.4
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 31.3.3
• Dart plugin version 182.5124
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] IntelliJ IDEA Community Edition (version 2018.3.4)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 32.0.3
• Dart plugin version 183.5429.25
[✓] VS Code (version 1.30.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.22.2
[✓] Connected device (1 available)
• iPhone SE • 58F34A3E-1576-453E-B1B4-3DCB22E1FEDD • ios • iOS 12.1 (simulator)
Might be related to #27333 but error message and reproduction steps are difference.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
c: contributor-productivityTeam-specific productivity, code health, technical debt.Team-specific productivity, code health, technical debt.c: crashStack traces logged to the consoleStack traces logged to the consolec: flakeTests that sometimes, but not always, incorrectly passTests that sometimes, but not always, incorrectly passcustomer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.Relating to flutter/gallery repository. Please transfer non-framework issues there.f: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: cupertino_uicupertino_ui package in flutter/packagescupertino_ui package in flutter/packages

Activity
genesiscz commentedon Feb 10, 2019
I am also getting this. I navigate user from Login to Profile if the user have been already logged in by
Navigator.pushReplacementNamed(context, "/profile");. It correctly redirects to login, but when I Navigate back withNavigator.pushReplacementNamed(context, "/login");and then try to navigate back to profile after logging in, I get this errorgenesiscz commentedon Feb 10, 2019
And just fixed.
In my logout routine from profile, I have had called
Navigator.popAndPushNamed(context, "/login");instead ofNavigator.pushReplacementNamed(context, "/login");.When I changed it to the second one, it started to working. Could somebody elaborate why is it the case and what are the differences between these two? @zoechi @Hixie ?
xster commentedon Feb 12, 2019
Reminder for future: Matt hypothesizes that the swipe dismiss animation may still be ongoing after a next route has been pushed by tapping the next demo.
Shu-Ji commentedon Feb 28, 2019
On my mobile, only CupertinoPageRoute has the problem. And if user presses the
backbutton on Android or clicks a close icon on my page, this bug will not happen.It only occurs when user swipe back to the previous page, and before the animation finished, quickly click some link to open a new route again, it crashes.
After some days, I get it worked:
STEP 1 —— Define an observer to listen the swipe back gesture:
STEP 2 —— Add the observer in our main.dart:
STEP 3 —— Wait the animation before open a new page
STEP 4 —— Usage
TomLiu-GitHub commentedon Apr 2, 2019
The sliding not finished, but you can click back or other at the same time.
Like this.


Is this a bug?@HansMuller
xster commentedon Apr 3, 2019
@TomLiu-GitHub I filed a separate bug for it. #30416
TomLiu-GitHub commentedon Apr 8, 2019
This bug not been noticed. I think it's a very serious bug.
gsy13213009 commentedon Oct 12, 2019
I use Future.dealyed solved this problem
github-actions commentedon Aug 14, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.