@@ -25,7 +25,7 @@ to an existing project.
25
25
To create a new app that includes web support, run the following command:
26
26
27
27
``` console
28
- $ flutter create my_app
28
+ $ flutter create my_app
29
29
```
30
30
31
31
### Add web support to an existing project
@@ -38,10 +38,14 @@ $ flutter create . --platforms web
38
38
```
39
39
40
40
This creates a ` web/ ` directory containing the web assets used to bootstrap
41
- and run your Flutter app.
41
+ and run your Flutter app.
42
42
43
43
## Run your app
44
44
45
+ See the following sections to run your app.
46
+
47
+ ### Run your app from the command line
48
+
45
49
Select [ Chrome] [ ] as your app's target device to run and debug
46
50
a Flutter web app:
47
51
@@ -58,68 +62,79 @@ navigate to a local URL in the browser of your choice.
58
62
<a id =" hot-reload-web " aria-hidden =" true " ></a >
59
63
60
64
:::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.
66
68
67
69
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] [ ] .
69
71
Note this is in the Dart SDK repository where it's easier
70
72
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:
72
79
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
+ ```
75
83
76
- ### Running from VS Code
84
+ Flutter web offers multiple build modes and renderers.
85
+ For more information, see [ Web renderers] [ ] .
77
86
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
+ ```
81
109
82
- ### Running from the command line
110
+ ### Disable hot reload from the command line
83
111
84
112
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
86
114
following command:
87
115
88
116
``` console
89
- flutter run -d chrome --web-experimental-hot-reload
117
+ flutter run -d chrome --no- web-experimental-hot-reload
90
118
```
91
119
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
97
121
98
122
Hot reload is also enabled in DartPad with a new "Reload" button.
99
123
The feature is only available if Flutter is detected
100
124
in the running application. You can begin a hot reloadable
101
125
session by selecting a sample app provided by DartPad.
102
126
103
- :::
104
-
105
127
[ Hot restart ] : /tools/hot-reload
106
128
[ How to switch channels ] : /install/upgrade#switching-flutter-channels
107
129
[ `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
109
131
[ GitHub project ] : {{site.github}}/orgs/dart-lang/projects/107/views/1
110
132
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
118
134
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.
121
136
122
- ## Build your app
137
+ ### Build your app from the command line
123
138
124
139
Run the following command to generate a release build:
125
140
0 commit comments