0 Star 0 Fork 0

coding-playground/dart-webdev-quickstart

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Dart webdev quickstart.

Setup

  1. Install Dart

    brew tap dart-lang/dart
    brew install dart
    
  2. Get CLI tools or an IDE (or both)

    If you like to use the command line, install webdev and stagehand:

    pub global activate webdev
    pub global activate stagehand
    

    Although using an IDE is optional, we highly recommend using one. For a list of available IDEs, see the overview of editors & debuggers.

  3. Create a web app

    To create a web app from the command line, use these commands:

    mkdir quickstart
    cd quickstart
    stagehand web-simple
    pub get
    

    web To create the same web app from an IDE that has Dart integration, create a project using the template named Bare-bones Web App.

  4. Run the app

    To run the app from the command line, use webdev to build and serve the app:

    webdev serve
    

    Or run the app from your IDE.

  5. View your app

    To view your app, use the Chrome browser to visit the app’s URL — for example, localhost:8080.

    Whether you use an IDE or the command line, webdev serve builds and serves your app using the Dart development compiler, dartdevc. Startup is slowest the first time dartdevc builds and serves your app. After that, assets are cached on disk and incremental builds are much faster.

    Once your app has compiled, the browser should display “Your Dart app is running.”

  6. Build & Deploy

    1. 构建,执行以下命令构建并生成 build 目录,该目录即为发布根目录
      webdev build
      
    2. 发布,将 build 产物发布到 WEB server 可以发布到 nginx,本地开发预览可以使用 anywhere (可以在任何文件目录启动 WEB 服务)进行预览
      npm install anywhere
      
      cd build
      
      anywhere
      

Exception

1. Library import not working

package not install error

# Use Command
pub cache repair

# Result Report
Reinstalled 83 packages.
Reactivating stagehand 3.3.2...
Precompiling executables... (1.7s)
Precompiled stagehand:stagehand.
Installed executable stagehand.
Reactivating webdev 2.2.0...
Precompiling executables... (4.3s)
Precompiled webdev:webdev.
Installed executable webdev.
Reactivated 2 packages.

# Download packages
pub get

2. Getter not found: 'JSON'

错误提示:Error: Getter not found: 'JSON'.
原因:json在新版flutter中升级了,由大写改成小写了。全部改小写就对了。

Reference

空文件

简介

使用 Dart 语言 webdev building 模式构建,用于熟悉 Dart 语法和基于 Dart 开发 WEB 项目的流程。 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Dart
1
https://gitee.com/coding-playground/dart-webdev-quickstart.git
git@gitee.com:coding-playground/dart-webdev-quickstart.git
coding-playground
dart-webdev-quickstart
dart-webdev-quickstart
master

搜索帮助