Skip to content
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

chore: remove Flutter web deprecations #3932

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

ndonkoHenri
Copy link
Collaborator

@ndonkoHenri ndonkoHenri commented Sep 3, 2024

Description

Running flutter build web shows the following deprecation warning:

Warning: In index.html:40: Local variable for "serviceWorkerVersion" is deprecated. Use
"{{flutter_service_worker_version}}" template token instead. See
https://docs.flutter.dev/platform-integration/web/initialization for more details.
Warning: In index.html:107: "FlutterLoader.loadEntrypoint" is deprecated. Use "FlutterLoader.load"
instead. See https://docs.flutter.dev/platform-integration/web/initialization for more details.

Right now one still appears:

Warning: In index.html:40: Local variable for "serviceWorkerVersion" is deprecated. Use
"{{flutter_service_worker_version}}" template token instead. See
https://docs.flutter.dev/platform-integration/web/initialization for more details.

// The value below is injected by flutter build, do not touch.
var serviceWorkerVersion = null;

removing the above line clears the last deprecation warning.
@FeodorFitsner, any suggestion?

Summary by Sourcery

Remove deprecated Flutter web code by replacing 'FlutterLoader.loadEntrypoint' with 'FlutterLoader.load' and updating the service worker version handling to use the '{{flutter_service_worker_version}}' template token.

Enhancements:

  • Update the Flutter web initialization code to use the new 'FlutterLoader.load' method instead of the deprecated 'FlutterLoader.loadEntrypoint'.

Copy link
Contributor

sourcery-ai bot commented Sep 3, 2024

Reviewer's Guide by Sourcery

This pull request addresses deprecation warnings in the Flutter web build process by updating the index.html file. The changes focus on replacing deprecated syntax with the recommended approach for initializing the Flutter loader and specifying the service worker version.

File-Level Changes

Change Details Files
Update Flutter web initialization code to remove deprecations
  • Replace '_flutter.loader.loadEntrypoint' with '_flutter.loader.load'
  • Change 'serviceWorker' object to 'serviceWorkerSettings'
  • Replace 'serviceWorkerVersion: serviceWorkerVersion' with 'serviceWorkerVersion: {{flutter_service_worker_version}}'
client/web/index.html

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ndonkoHenri - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Good job addressing the deprecation warnings. Consider investigating the remaining warning about 'serviceWorkerVersion' to see if it can be resolved in this PR as well, ensuring all deprecation issues are addressed at once.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@FeodorFitsner
Copy link
Contributor

This PR requires more attention/work than expected :)

  1. We need to make sure the new initialization mechanism works with flutter_native_splash in flet-build-template repo and then update init code there.
  2. "HTML" renderer has gone! https://docs.flutter.dev/platform-integration/web/renderers#renderers and was replaced with skwasm which is related to WASM compilation we are working on in the other branch.

@FeodorFitsner FeodorFitsner merged commit 4f51c12 into main Oct 16, 2024
1 of 2 checks passed
@FeodorFitsner FeodorFitsner deleted the patch-flutter-web-deprecations branch October 16, 2024 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants