Skip to content

Commit cbd2993

Browse files
nshahanparloughantfitch
authored
[3.35] Update docs for hot reload on the web (#12216)
* To be published with the release of 3.35.0. * The feature is now enabled by default on the web flutter/flutter#169174. * Updates "how to enable" instructions into "how to disable". Previews: * https://flutter-docs-prod--pr12216-hot-reload-web-docs-qhvj2eu0.web.app/platform-integration/web/building * https://flutter-docs-prod--pr12216-hot-reload-web-docs-qhvj2eu0.web.app/tools/hot-reload --------- Co-authored-by: Parker Lougheed <[email protected]> Co-authored-by: Amanda Fitch <[email protected]>
1 parent 466ec86 commit cbd2993

File tree

2 files changed

+59
-44
lines changed

2 files changed

+59
-44
lines changed

src/content/platform-integration/web/building.md

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ to an existing project.
2525
To create a new app that includes web support, run the following command:
2626

2727
```console
28-
$ flutter create my_app
28+
$ flutter create my_app
2929
```
3030

3131
### Add web support to an existing project
@@ -38,10 +38,14 @@ $ flutter create . --platforms web
3838
```
3939

4040
This creates a `web/` directory containing the web assets used to bootstrap
41-
and run your Flutter app.
41+
and run your Flutter app.
4242

4343
## Run your app
4444

45+
See the following sections to run your app.
46+
47+
### Run your app from the command line
48+
4549
Select [Chrome][] as your app's target device to run and debug
4650
a Flutter web app:
4751

@@ -58,68 +62,79 @@ navigate to a local URL in the browser of your choice.
5862
<a id="hot-reload-web" aria-hidden="true" ></a>
5963

6064
:::note Hot reload on the web
61-
As of the Flutter 3.32 release, you can experiment
62-
with hot reload on the web behind a flag.
63-
[Hot restart][], which restarts your app
64-
without refreshing the web page,
65-
doesn't require a flag.
65+
As of the Flutter 3.35 release,
66+
hot reload is enabled by default on the web.
67+
[Hot restart][] is still available as well.
6668

6769
If you discover any issues we ask that you file a bug
68-
using our new [Web Hot Reload issue template][].
70+
using our [Web Hot Reload issue template][].
6971
Note this is in the Dart SDK repository where it's easier
7072
for us to track issues. Known issues can be seen in the
71-
associated [GitHub project][].
73+
associated [GitHub project][].
74+
:::
75+
76+
### Run your app using WebAssembly
77+
78+
You can pass the `--wasm` flag to run your app using WebAssembly:
7279

73-
To try hot reload for the web, pass the `--web-experimental-hot-reload` flag
74-
wherever you invoke `flutter run -d chrome`.
80+
```console
81+
$ flutter run -d chrome --wasm
82+
```
7583

76-
### Running from VS Code
84+
Flutter web offers multiple build modes and renderers.
85+
For more information, see [Web renderers][].
7786

78-
If you use debug configurations in VS code,
79-
you can add this extra configuration to your
80-
[`launch.json` file][].
87+
### Disable hot reload in VS Code
88+
89+
To temporarily disable hot reload support from VS Code,
90+
update your [`launch.json` file][] file with
91+
the flag `--no-web-experimental-hot-reload`.
92+
93+
```plaintext
94+
"configurations": [
95+
...
96+
{
97+
"name": "Flutter for web (hot reload disabled)",
98+
"type": "dart",
99+
"request": "launch",
100+
"program": "lib/main.dart",
101+
"args": [
102+
"-d",
103+
"chrome",
104+
"--no-web-experimental-hot-reload",
105+
]
106+
}
107+
]
108+
```
81109

82-
### Running from the command line
110+
### Disable hot reload from the command line
83111

84112
If you use `flutter run` from the command line,
85-
you can now run hot reload on the web with the
113+
you can temporarily disable hot reload on the web with the
86114
following command:
87115

88116
```console
89-
flutter run -d chrome --web-experimental-hot-reload
117+
flutter run -d chrome --no-web-experimental-hot-reload
90118
```
91119

92-
When hot reload is enabled,
93-
you can reload your application by pressing "r"
94-
in the running terminal, or "R" to hot restart.
95-
96-
### Reloading in DartPad
120+
### Use hot reload in DartPad
97121

98122
Hot reload is also enabled in DartPad with a new "Reload" button.
99123
The feature is only available if Flutter is detected
100124
in the running application. You can begin a hot reloadable
101125
session by selecting a sample app provided by DartPad.
102126

103-
:::
104-
105127
[Hot restart]: /tools/hot-reload
106128
[How to switch channels]: /install/upgrade#switching-flutter-channels
107129
[`launch.json` file]: https://code.visualstudio.com/docs/debugtest/debugging-configuration
108-
[Web Hot Reload issue template]: {{site.github}}/dart-lang/sdk/issues/new?template=6_web_hot_reload.yml
130+
[Web Hot Reload issue template]: {{site.github}}/dart-lang/sdk/issues/new?template=5_web_hot_reload.yml
109131
[GitHub project]: {{site.github}}/orgs/dart-lang/projects/107/views/1
110132

111-
### Run your app using WebAssembly
112-
113-
You can pass the `--wasm` flag to run your app using WebAssembly:
114-
115-
```console
116-
$ flutter run -d chrome --wasm
117-
```
133+
## Build your app
118134

119-
Flutter web offers multiple build modes and renderers.
120-
For more information, see [Web renderers][].
135+
See the following sections to build your app.
121136

122-
## Build your app
137+
### Build your app from the command line
123138

124139
Run the following command to generate a release build:
125140

src/content/tools/hot-reload.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,25 @@ The code updates and execution continues.
7676
**What is the difference between hot reload, hot restart,
7777
and full restart?**
7878

79-
* **Hot reload** loads code changes into the VM and re-builds
80-
the widget tree, preserving the app state;
79+
* **Hot reload** loads code changes into the VM or the browser,
80+
and re-builds the widget tree, preserving the app state;
8181
it doesn't rerun `main()` or `initState()`.
8282
(`⌘\` in Intellij and Android Studio, `⌃F5` in VSCode)
83-
* **Hot restart** loads code changes into the VM,
83+
* **Hot restart** loads code changes into the VM or the browser,
8484
and restarts the Flutter app, losing the app state.
85+
On the web, this can restart the app without a full page refresh.
8586
(`⇧⌘\` in IntelliJ and Android Studio, `⇧⌘F5` in VSCode)
8687
* **Full restart** restarts the iOS, Android, or web app.
8788
This takes longer because it also recompiles the
88-
Java / Kotlin / Objective-C / Swift code. On the web,
89-
it also restarts the Dart Development Compiler.
89+
Java / Kotlin / Objective-C / Swift / JavaScript code.
90+
On the web, it also restarts the Dart Development Compiler.
9091
There is no specific keyboard shortcut for this;
9192
you need to stop and start the run configuration.
9293

93-
Flutter web currently supports hot restart and
94-
[hot reload behind an experimental flag][].
94+
Flutter web now supports hot restart and [hot reload][].
9595
:::
9696

97-
[hot reload behind an experimental flag]: /platform-integration/web/building#hot-reload-web
97+
[hot reload]: /platform-integration/web/building#hot-reload-web
9898

9999
![Android Studio UI](/assets/images/docs/development/tools/android-studio-run-controls.png){:width="100%"}<br>
100100
Controls for run, run debug, hot reload, and hot restart in Android Studio

0 commit comments

Comments
 (0)