mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() This makes several changes to flutter web app bootstrapping. * The build now produces a `flutter_bootstrap.js` file. * By default, this file does the basic streamlined startup of a flutter app with the service worker settings and no user configuration. * The user can also put a `flutter_bootstrap.js` file in the `web` subdirectory in the project directory which can have whatever custom bootstrapping logic they'd like to write instead. This file is also templated, and can use any of the tokens that can be used with the `index.html` (with the exception of `{{flutter_bootstrap_js}}`, see below). * Introduced a few new templating tokens for `index.html`: * `{{flutter_js}}` => inlines the entirety of `flutter.js` * `{{flutter_service_worker_version}}` => replaced directly by the service worker version. This can be used instead of the script that sets the `serviceWorkerVersion` local variable that we used to have by default. * `{{flutter_bootstrap_js}}` => inlines the entirety of `flutter_bootstrap.js` (this token obviously doesn't apply to `flutter_bootstrap.js` itself). * Changed `IndexHtml` to be called `WebTemplate` instead, since it is used for more than just the index.html now. * We now emit warnings at build time for certain deprecated flows: * Warn on the old service worker version pattern (i.e.`(const|var) serviceWorkerVersion = null`) and recommends using `{{flutter_service_worker_version}}` token instead * Warn on use of `FlutterLoader.loadEntrypoint` and recommend using `FlutterLoader.load` instead * Warn on manual loading of `flutter_service_worker.js`. * The default `index.html` on `flutter create` now uses an async script tag with `flutter_bootstrap.js`. |
||
---|---|---|
.. | ||
app | ||
app_integration_test/integration_test | ||
app_shared | ||
app_test_widget/test | ||
cocoapods | ||
module | ||
package | ||
package_ffi | ||
plugin | ||
plugin_ffi | ||
plugin_shared | ||
skeleton | ||
xcode/ios/custom_application_bundle | ||
README.md | ||
template_manifest.json |
This directory contains templates for flutter create
.
The *_shared
subdirectories provide files for multiple templates.
app_shared
forapp
andskeleton
.plugin_shared
for (method channel)plugin
andplugin_ffi
.
For example, there are two app templates: app
(the counter app)
and skeleton
(the more advanced list view/detail view app).
┌────────────┐
│ app_shared │
└──┬──────┬──┘
│ │
│ │
▼ ▼
┌─────┐ ┌──────────┐
│ app │ │ skeleton │
└─────┘ └──────────┘
Thanks to app_shared
, the templates for app
and skeleton
can contain
only the files that are specific to them alone, and the rest is automatically
kept in sync.