[web] Custom Flutter initialization should survive hot restart #108403
Labels
e: flutter.js
Issues with Flutter web custom initialization through JS APIs
P1
High-priority issues at the top of the work list
platform-web
Web applications specifically
Uh oh!
There was an error while loading. Please reload this page.
The current flutter.js initialization flow does not support hot restart with custom initialization, because after the original promise is resolved, it cannot be resolved anymore.
The current workaround is to remove the
didCreateEngineInitializer
method once it's been used, but that reverts the initialization of flutter to "Auto" (and defaults). This won't play well with the next steps of embedding flutter in a custom element, or any other data that we might want to pass from JS to a flutter app.flutter/packages/flutter_tools/lib/src/web/file_generators/flutter_js.dart
Lines 73 to 74 in c4b3625
flutter.js should support multiple hot restarts, keeping the custom initialization. To do so, a new onEngineInitialized API might need to be added to the flutter loader, so programmers can subscribe to Hot Restart events, rather than waiting for the resolution of a promise (that only happens the first time)
The text was updated successfully, but these errors were encountered: