text
stringlengths 1
372
|
|---|
and places the files into the /build/web
|
directory of the project.
|
the release build of a simple app has the
|
following structure:
|
info note
|
the canvaskit directory and its contents are only present when the
|
CanvasKit renderer is selected—not when the HTML renderer is selected.
|
launch a web server (for example,
|
python -m http.server 8000,
|
or by using the dhttpd package),
|
and open the /build/web directory. navigate to
|
localhost:8000 in your browser
|
(given the python SimpleHTTPServer example)
|
to view the release version of your app.
|
<topic_end>
|
<topic_start>
|
deploying to the web
|
when you are ready to deploy your app,
|
upload the release bundle
|
to firebase, the cloud, or a similar service.
|
here are a few possibilities, but there are
|
many others:
|
<topic_end>
|
<topic_start>
|
deploying to firebase hosting
|
you can use the firebase CLI to build and release your flutter app with firebase
|
hosting.
|
<topic_end>
|
<topic_start>
|
before you begin
|
to get started, install or update the firebase CLI:
|
<topic_end>
|
<topic_start>
|
initialize firebase
|
enable the web frameworks preview to the firebase framework-aware CLI:
|
in an empty directory or an existing flutter project, run the initialization
|
command:
|
answer yes when asked if you want to use a web framework.
|
if you’re in an empty directory,
|
you’ll be asked to choose your web framework. choose flutter web.
|
choose your hosting source directory; this could be an existing flutter app.
|
select a region to host your files.
|
choose whether to set up automatic builds and deploys with GitHub.
|
deploy the app to firebase hosting:
|
running this command automatically runs flutter build web --release,
|
so you don’t have to build your app in a separate step.
|
to learn more, visit the official firebase hosting documentation for
|
flutter on the web.
|
<topic_end>
|
<topic_start>
|
handling images on the web
|
the web supports the standard image widget to display images.
|
by design, web browsers run untrusted code without harming the host computer.
|
this limits what you can do with images compared to mobile and desktop platforms.
|
for more information, see displaying images on the web.
|
<topic_end>
|
<topic_start>
|
choosing a web renderer
|
by default, the flutter build and flutter run commands
|
use the auto choice for the web renderer. this means that
|
your app runs with the HTML renderer on mobile browsers and
|
CanvasKit on desktop browsers. we recommend this combination
|
to optimize for the characteristics of each platform.
|
for more information, see web renderers.
|
<topic_end>
|
<topic_start>
|
minification
|
minification is handled for you when you
|
create a release build.
|
<topic_end>
|
<topic_start>
|
embedding a flutter app into an HTML page
|
<topic_end>
|
<topic_start>
|
hostElement
|
added in flutter 3.10
|
you can embed a flutter web app into
|
any HTML element of your web page, with flutter.js and the hostElement
|
engine initialization parameter.
|
to tell flutter web in which element to render, use the hostElement parameter of the initializeEngine
|
function:
|
to learn more, check out customizing web app initialization.
|
<topic_end>
|
<topic_start>
|
iframe
|
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 HTML page:
|
<topic_end>
|
<topic_start>
|
PWA support
|
as of release 1.20, the flutter template for web apps includes support
|
for the core features needed for an installable, offline-capable PWA app.
|
flutter-based PWAs can be installed in the same way as any other web-based
|
PWA; the settings signaling that your flutter app is a PWA are provided by
|
manifest.json, which is produced by flutter create in the web directory.
|
PWA support remains a work in progress,
|
so please give us feedback if you see something that doesn’t look right.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.