Flutter打包web,开启本地服务
将flutter项目打包web,并开启本地服务在本地预览.
Flutter打包web,开启本地服务
打包运行web
第一步:使已有flutter项目,支持web,在控制台 cd到项目目录
1
flutter config --enable-web
第二步,在项目根目录执行flutter create .注意有个英文符号点!
1
flutter create .
第三步,执行flutter build web就能看到web目录创建成功了。
1
flutter build web
如果想在Chrome浏览器运行:
1
flutter run -d chrome
开启本地服务:
- 安装python3
- 终端进入到对应的web文件夹下
- 执行python3 -m http.server 8000
- 在浏览器中http://localhost:8000/#/
This post is licensed under CC BY 4.0 by the author.