准备Flutter web 环境:
开启项目支持Flutter web:
flutter config --enable-web
更新flutter:
flutter pub global activate webdev
修改bash_profile文件:
export PATH="$PATH":"$HOME/Downloads/flutter/.pub-cache/bin
添加web支持, 在根目录下新建web文件夹(web和lib文件夹同级), 然后新建index.html文件, 文件内容如下:
index.html文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>education_flutter</title>
</head>
<body>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
切换:
flutter channel master
flutter devices
Chorme运行:
运行显示如下:
PS:
有个问题,修改代码,怎么实时刷新界面呢,现在我是每次执行flutter run -d chrome命令。求解答~~~