Skip to content
Open
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ _flutter.loader.load({
});
```

## Common warning
## Common warnings {:#common-warnings}

### Service worker version deprecation
Comment on lines +263 to +265

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Per the Google dev style guide and Flutter doc guidelines, avoid stacking headings without intervening text!

Suggested change
## Common warnings {:#common-warnings}
### Service worker version deprecation
## Common warnings {:#common-warnings}
This section describes common web build and initialization warnings
and how to resolve them.
### Service worker version deprecation


If you experience a warning similar to the following:

Expand All @@ -269,8 +271,49 @@ Warning: In index.html:37: Local variable for "serviceWorkerVersion" is deprecat
Use "{{flutter_service_worker_version}}" template token instead.
```

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

```html title="web/index.html"
var serviceWorkerVersion = null;
```

### FlutterLoader.loadEntrypoint deprecation

If you experience a warning similar to the following:

```text
Warning: In index.html:40: "FlutterLoader.loadEntrypoint" is deprecated.
Use "FlutterLoader.load" instead.
```

This warning occurs when an older `web/index.html` file uses
`_flutter.loader.loadEntrypoint()` instead of `_flutter.loader.load()`.
The CLI message references the `FlutterLoader` interface,
which JavaScript code accesses through `_flutter.loader`.

If your app uses the default initialization and doesn't require
custom bootstrapping, replace the legacy script block in `web/index.html`
with the standard script tag:

```html title="web/index.html"
<script src="flutter_bootstrap.js" async></script>
```

If you customized your initialization logic,
update your bootstrap code in `web/index.html`
(or a custom `web/flutter_bootstrap.js` file)
to call `_flutter.loader.load()` instead:

```js
_flutter.loader.load({
onEntrypointLoaded: async function(engineInitializer) {
const appRunner = await engineInitializer.initializeEngine();
await appRunner.runApp();
}
});
```

To review an example that updates DOM elements during startup,
consult the [progress indicator example][].

[progress indicator example]: #example-display-a-progress-indicator
Loading