-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
a: state restorationRestorationManager and related APIsRestorationManager and related APIsc: crashStack traces logged to the consoleStack traces logged to the consolet: hot reloadReloading code during "flutter run"Reloading code during "flutter run"
Description
First discovered when migrating the gallery to make use of state restoration: flutter/gallery#389.
This issue is seen in the Reply and Shrine mini apps, both of which use state management packages (provider and scoped_model).
Reproducible sample: https://github.com/shihaohong/state_restoration_provider_crash
Steps to reproduce:
- Run the Flutter application
- Make any changes to the code in your IDE (ie. adding spaces after a line of code) and save.
- Hot Reload
Stack trace:
Unhandled exception:
root::package:hot_reload_crash/main.dart::_RestorableCounterState::@methods::package:flutter/src/widgets/restoration.dart::_debugAssertNotDisposed is already bound
#0 CanonicalName.bindTo (package:kernel/canonical_name.dart:192:7)
#1 Class.computeCanonicalNames (package:kernel/ast.dart:1201:51)
#2 Library.computeCanonicalNames (package:kernel/ast.dart:559:14)
#3 Component.computeCanonicalNamesForLibrary (package:kernel/ast.dart:10821:13)
#4 Component.computeCanonicalNames (package:kernel/ast.dart:10783:7)
#5 sortComponent (package:vm/kernel_front_end.dart:679:13)
#6 FrontendCompiler.writeDillFile (package:frontend_server/frontend_server.dart:656:5)
#7 FrontendCompiler.recompileDelta (package:frontend_server/frontend_server.dart:766:13)I also noticed that this only happens when hot reload is called in the Dart files where _RestorableCounterState is defined. The sample all only has one Dart file, but in the gallery app, this is more apparent since changes to files that do not contain the RestorableListenable class do not trigger the crash.
Metadata
Metadata
Assignees
Labels
a: state restorationRestorationManager and related APIsRestorationManager and related APIsc: crashStack traces logged to the consoleStack traces logged to the consolet: hot reloadReloading code during "flutter run"Reloading code during "flutter run"