Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[web] Custom Flutter initialization should survive hot restart #108403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ditman opened this issue Jul 27, 2022 · 1 comment · Fixed by #108776
Closed

[web] Custom Flutter initialization should survive hot restart #108403

ditman opened this issue Jul 27, 2022 · 1 comment · Fixed by #108776
Assignees
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

Comments

@ditman
Copy link
Member

ditman commented Jul 27, 2022

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.

// Remove the public method after it's done, so Flutter Web can hot restart.
delete this.didCreateEngineInitializer;

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)

@ditman ditman added platform-web Web applications specifically P1 High-priority issues at the top of the work list e: flutter.js Issues with Flutter web custom initialization through JS APIs labels Jul 27, 2022
@ditman ditman self-assigned this Jul 27, 2022
@github-actions
Copy link

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 -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant