一、下载html
wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.22.6-stable.tar.xz
二、解压linux
cd /data/app xz -d flutter_linux_1.22.6-stable.tar.xz tar xvf flutter_linux_1.22.5-stable.tar
三、设置PATH环境变量ios
ln -s /data/app/flutter/bin/flutter /usr/bin/flutter ln -s /data/app/flutter/bin/flutter /usr/local/bin/flutter
添加下面代码,其中第一行是你flutter解压的位置,另外两行是为了解决国内访问flutter慢的问题,必定要添加,否则根本就没法使用。web
# vim /etc/profile ####添加下面代码 export PUB_HOSTED_URL=https://pub.flutter-io.cn #国内用户须要设置 export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn #国内用户须要设置 export PATH=${PATH}:/data/app/flutter/bin
加载环境变量vim
source /etc/profile
四、测试命令,验证是否已经成功添加依赖api
flutter doctor
brew update brew install --HEAD libimobiledevice brew install ideviceinstaller ios-deploy cocoapods
因为在国内访问Flutter有时可能会受到限制,Flutter官方为中国开发者搭建了临时镜像,你们能够将以下环境变量加入到用户环境变量中:app
export PUB_HOSTED_URL=https://pub.flutter-io.cnexport FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
open -a Simulator
flutter create my_app cd my_app flutter run
到这一步,第一个demo就启动完成了编辑器
咱们建议使用官方的编辑器插件之一,以得到更好的体验。经过官方的编辑器插件,您能够得到代码补全、语法高亮、widget编辑辅助、运行和调试支持等等。支持Android Studio、IntelliJ或VS Code添加编辑器插件。ide
选择 File>New Flutter Project