text
stringlengths
1
372
but not hot reload in a web browser.
<topic_end>
<topic_start>
build
run the following command to generate a release build:
a release build uses dart2js
(instead of the development compiler)
to produce a single JavaScript file main.dart.js.
you can create a release build using release mode
(flutter run --release) or by using flutter build web.
this populates a build/web directory
with built files, including an assets directory,
which need to be served together.
you can also include --web-renderer html or --web-renderer canvaskit to
select between the HTML or CanvasKit renderers, respectively. for more
information, see web renderers.
for more information, see
build and release a web app.
<topic_end>
<topic_start>
add web support to an existing app
to add web support to an existing project
created using a previous version of flutter,
run the following command
from your project’s top-level directory:
<topic_end>
<topic_start>
web FAQ
<topic_end>
<topic_start>
what scenarios are ideal for flutter on the web?
not every web page makes sense in flutter, but we think flutter is particularly
suited for app-centric experiences:
at this time, flutter is not suitable for static websites with text-rich
flow-based content. for example, blog articles benefit from the document-centric
model that the web is built around, rather than the app-centric services that a
UI framework like flutter can deliver. however, you can use flutter to embed
interactive experiences into these websites.
for more information on how you can use flutter on the web,
see web support for flutter.
<topic_end>
<topic_start>
search engine optimization (seo)
in general, flutter is geared towards dynamic application experiences. flutter’s
web support is no exception. flutter web prioritizes performance, fidelity, and
consistency. this means application output does not align with what search
engines need to properly index. for web content that is static or document-like,
we recommend using HTML—just like we do on flutter.dev,
dart.dev, and pub.dev. you should also
consider separating your primary application experience—created in flutter—from
your landing page, marketing content, and help content—created using
search-engine optimized HTML.
<topic_end>
<topic_start>
how do i create an app that also runs on the web?
see building a web app with flutter.
<topic_end>
<topic_start>
does hot reload work with a web app?
no, but you can use hot restart. hot restart is a fast way of seeing your
changes without having to relaunch your web app and wait for it to compile and
load. this works similarly to the hot reload feature for flutter mobile
development. the only difference is that hot reload remembers your state and hot
restart doesn’t.
<topic_end>
<topic_start>
how do i restart the app running in the browser?
you can either use the browser’s refresh button,
or you can enter “r” in the console where
“flutter run -d chrome” is running.
<topic_end>
<topic_start>
which web browsers are supported by flutter?
flutter web apps can run on the following browsers:
during development, chrome (on macOS, windows, and linux) and edge (on windows)
are supported as the default browsers for debugging your app.
<topic_end>
<topic_start>
can i build, run, and deploy web apps in any of the IDEs?
you can select chrome or edge as the target device in
android Studio/IntelliJ and VS code.
the device pulldown should now include the chrome (web)
option for all channels.
<topic_end>
<topic_start>
how do i build a responsive app for the web?
see creating responsive apps.
<topic_end>
<topic_start>
can i use dart:io with a web app?
no. the file system is not accessible from the browser.
for network functionality, use the http
package. note that security works somewhat
differently because the browser (and not the app)
controls the headers on an HTTP request.
<topic_end>
<topic_start>
how do i handle web-specific imports?
some plugins require platform-specific imports, particularly if they use the
file system, which is not accessible from the browser. to use these plugins