安装依赖

  1. # 安装相关工具
  2. pub global activate webdev
  3. pub global activate stagehand

开发 web 应用

  1. # 创建web应用
  2. mkdir quickstart
  3. cd quickstart
  4. stagehand web-simple
  5. # 安装依赖
  6. pub get
  7. # 启动服务
  8. $ webdev serve
  9. [INFO] Building new asset graph completed, took 816ms
  10. [INFO] Checking for unexpected pre-existing outputs. completed, took 0ms
  11. [INFO] Serving `web` on http://127.0.0.1:8080
  12. [INFO] Running build completed, took 974ms
  13. [INFO] Caching finalized dependency graph completed, took 83ms
  14. [INFO] Succeeded after 1.1s with 11 outputs (1437 actions)
  15. [INFO] ----------------------------------------------------------------------------------------------------------------

可以看到应用启动在 [http://127.0.0.1:8080](http://127.0.0.1:8080), 打开浏览器访问, 页面输出: Your Dart app is running.

目录结构

新建的目录结构如下:
image.png