Skip to content

Commit fa75cf2

Browse files
sfshaza2parlough
andauthored
Add a note on how to fix warning about deprecated local var (#11779)
Fixes #11778 cc @johnpryan @kevmoo --------- Co-authored-by: Parker Lougheed <[email protected]>
1 parent 8b7d5b5 commit fa75cf2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/content/platform-integration/web/initialization.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ substitute in either the `flutter_bootstrap.js` or `index.html` files:
7373
|---|---|
7474
| `{% 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.) |
7575
| `{% 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. |
76-
| `{% 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). |
76+
| `{% 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). |
7777
| `{% 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. |
7878

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

104-
## Customize the Flutter Loader
104+
## Customize the Flutter loader
105105

106106
The `_flutter.loader.load()` JavaScript API can be invoked with optional
107107
arguments to customize initialization behavior:
@@ -210,3 +210,18 @@ _flutter.loader.load({
210210
}
211211
});
212212
```
213+
214+
## Common warning
215+
216+
If you experience a warning similar to the following:
217+
218+
```text
219+
Warning: In index.html:37: Local variable for "serviceWorkerVersion" is deprecated.
220+
Use "{{flutter_service_worker_version}}" template token instead.
221+
```
222+
223+
You can fix this by deleting the following line in the `web/index.html` file:
224+
225+
```html title="web/index.html"
226+
var serviceWorkerVersion = null;
227+
```

0 commit comments

Comments
 (0)