Set up web development for Flutter from Android on ChromeOS start
To add web as a Flutter app target for ChromeOS with Android, follow this procedure.
Configure Chrome as the web DevTools tools
#-
Allocate a minimum of 1 GB of storage for Google Chrome. Consider allocating 2 GB of storage for an optimal configuration.
-
Download and install the ChromeOS version of Google Chrome to debug JavaScript code for web apps.
检查你的开发配置
#运行 Flutter doctor
#flutter doctor
指令将检查 ChromeOS 完整的
Flutter 开发环境的所有组件。
-
Open 一个 shell.
打开一个 shell。
-
要检查所有组件的安装情况,请运行以下指令。
flutter doctor
由于你选择为 Web 进行开发,因此不需要 所有 组件。如果你遵循本指南,指令结果应该类似于:
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.1, on , locale en)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.5)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.89)
[✓] Connected device (1 available)
[✓] Network resources
∙ No issues found!
解决 Flutter doctor 的问题
#当 flutter doctor
指令返回错误时,可能是 Flutter、VS Code、、连接的设备或者网络资源出错。
如果 flutter doctor
指令返回这些组件中的任何一个错误,请使用 verbose 标志再次运行。
flutter doctor -v
查看输出结果,了解可能需要安装的其他软件或者需要执行的其他任务。
如果你更改了 Flutter SDK 或其他相关组件的配置,请 再次运行 flutter doctor
来检查安装。
开始使用 Flutter 开发 Web on ChromeOS 应用
#恭喜你!现在,你已经安装了所有必要条件和 Flutter SDK,你可以开始为 Web on ChromeOS 开发 Flutter 应用了。