text
stringlengths
1
372
in your app, see the documentation for conditional imports
on dart.dev.
<topic_end>
<topic_start>
does flutter web support concurrency?
dart’s concurrency support via isolates
is not currently supported in flutter web.
flutter web apps can potentially work around this
by using web workers,
although no such support is built in.
<topic_end>
<topic_start>
how do i embed a flutter web app in a web page?
you can embed a flutter web app,
as you would embed other content,
in an iframe tag of an HTML file.
in the following example, replace “url”
with the location of your hosted HTML page:
if you encounter problems, please file an issue.
<topic_end>
<topic_start>
how do i debug a web app?
use flutter DevTools for the following tasks:
use chrome DevTools for the following tasks:
<topic_end>
<topic_start>
how do i test a web app?
use widget tests or integration tests. to learn more about
running integration tests in a browser, see the integration testing page.
<topic_end>
<topic_start>
how do i deploy a web app?
see preparing a web app for release.
<topic_end>
<topic_start>
does platform.is work on the web?
not currently.
<topic_end>
<topic_start>
web renderers
when running and building apps for the web, you can choose between two different
renderers. this page describes both renderers and how to choose the best one for
your needs. the two renderers are:
<topic_end>
<topic_start>
command line options
the --web-renderer command line option takes one of three values, auto,
html, or canvaskit.
this flag can be used with the run or build subcommands. for example:
this flag is ignored when a non-browser (mobile or desktop) device
target is selected.
<topic_end>
<topic_start>
runtime configuration
to override the web renderer at runtime:
the web renderer can’t be changed after the flutter engine startup process
begins in main.dart.js.
info note
as of flutter 3.7.0, setting a window.flutterWebRenderer
(an approach used in previous releases) displays a
deprecation notice in the JS console. for more information,
check out customizing web app initialization.
<topic_end>
<topic_start>
choosing which option to use
choose the auto option (default) if you are optimizing for download size on
mobile browsers and optimizing for performance on desktop browsers.
choose the html option if you are optimizing download size over performance on
both desktop and mobile browsers.
choose the canvaskit option if you are prioritizing performance and
pixel-perfect consistency on both desktop and mobile browsers.
<topic_end>
<topic_start>
examples
run in chrome using the default renderer option (auto):
build your app in release mode, using the default (auto) option:
build your app in release mode, using just the CanvasKit renderer:
run your app in profile mode using the HTML renderer:
<topic_end>
<topic_start>
customizing web app initialization
you can customize how a flutter app is initialized on the web
using the _flutter.loader JavaScript API provided by flutter.js.
this API can be used to display a loading indicator in CSS,
prevent the app from loading based on a condition,
or wait until the user presses a button before showing the app.
the initialization process is split into the following stages:
this page shows how to customize the behavior
at each stage of the initialization process.
<topic_end>
<topic_start>
getting started
by default, the index.html file
generated by the flutter create command
contains a script tag
that calls loadEntrypoint from the flutter.js file:
info note
in flutter 2.10 or earlier,
this script doesn’t support customization.
to upgrade your index.html file to the latest version,