Install Dart
brew tap dart-lang/dart
brew install dart
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.
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.
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.
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.”
Build & Deploy
webdev build
npm install anywhere
cd build
anywhere
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
错误提示:Error: Getter not found: 'JSON'.
原因:json在新版flutter中升级了,由大写改成小写了。全部改小写就对了。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。