void main() { int age = 18; double height = 1.91; var money = 100; print(age); print(height); print(money); // operator + - * / 相關 print(10 + 10); //20 print(10 - 10); //0 print(10 / 2); //5 print(10 % 9); //1 bool isTrue = true; print(isTrue); print(10 == 9); //false if(10 > 9) { print("yes it is correct "); } // for loop循環語句 for (var i=1; i<=10; i++) { if( i % 2 == 0) { print("hello $i"); } } }
Dart SDK, 裏面有 Dart VM、核心庫、一些命令行工具,例如 dart、 dartanalyzer、 pub、 和 dartdoc。macos
$ brew tap dart-lang/dart $ brew install dart
如沒法下載,但它打印出了下載地址:api
https://storage.googleapis.com/dart-archive/channels/stable/release/2.1.0/sdk/dartsdk-macos-x64-release.zip
而後咱們用瀏覽器把這個文件下載下來, 而後查看Homebrew的緩存地址:瀏覽器
brew --cache
打印出以下地址:緩存
/Users/zhangzheyi/Library/Caches/Homebrew
將下載下來的文件拷貝到緩存地址工具
cp ~/Downloads/xxxxx /Users/zhangzheyi/Library/Caches/Homebrew
再次使用Homebrew安裝,這個時候Homebrew發現緩存中存在該文件,就安裝成功了oop
能夠運行下面的命令查看是否安裝成功:google
dart --version
看到以下信息:命令行
Dart VM version: 2.1.0 (Tue Nov 13 18:22:02 2018 +0100) on "macos_x64"code