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

Add a note on how to fix warning about deprecated local var #11779

Merged
merged 5 commits into from
Mar 12, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/content/platform-integration/web/initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ substitute in either the `flutter_bootstrap.js` or `index.html` files:
|---|---|
| `{% raw %}{{flutter_js}}{% endraw %}` | The JavaScript code that makes the `FlutterLoader` object available in the `_flutter.loader` global variable. (See the `_flutter.loader.load() API` section below for more details.) |
| `{% raw %}{{flutter_build_config}}{% endraw %}` | A JavaScript statement that sets metadata produced by the build process which gives the `FlutterLoader` information needed to properly bootstrap your application. |
| `{% raw %}{{flutter_service_worker_version}}{% endraw %}` | A unique number representing the build version of the service worker, which can be passed as part of the service worker configuration (see the "Service Worker Settings" table below). |
| `{% raw %}{{flutter_service_worker_version}}{% endraw %}` | A unique number representing the build version of the service worker, which can be passed as part of the service worker configuration (see the "Common warning" info below). |
| `{% raw %}{{flutter_bootstrap_js}}{% endraw %}` | As mentioned above, this inlines the contents of the `flutter_bootstrap.js` file directly into the `index.html` file. Note that this token can only be used in the `index.html` and not the `flutter_bootstrap.js` file itself. |

{:.table}
Expand Down Expand Up @@ -101,7 +101,7 @@ The most basic `flutter_bootstrap.js` file would look something like this:
_flutter.loader.load();
```

## Customize the Flutter Loader
## Customize the Flutter loader

The `_flutter.loader.load()` JavaScript API can be invoked with optional
arguments to customize initialization behavior:
Expand Down Expand Up @@ -210,3 +210,18 @@ _flutter.loader.load({
}
});
```

## Common warning

If you experience a warning similar to the following:

```text
Warning: In index.html:37: Local variable for "serviceWorkerVersion" is deprecated.
Use "{{flutter_service_worker_version}}" template token instead.
```

You can fix this by deleting the following line in the web/index.html file:

```html
var serviceWorkerVersion = null;
```