flutter环境搭建
1,flutter1.1,flutter sdk下载配置下载地址(Flutter官网):https://flutter.dev/docs/development/tools/sdk/releases?tab=macos1.2,配置环境变量export PATH=/Users/cixueting/Documents/flutter/flutter/bin:$PATHexport PUBHOSTED.
1,flutter
1.1,flutter sdk下载配置
下载地址(Flutter官网):https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
1.2,配置环境变量
export PATH=/Users/cixueting/Documents/flutter/flutter/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
2,Android开发环境
2.1,下载Android Studio
2.2,配置环境变量
export ANDROID_HOME="/Users/cixueting/Library/Android/sdk"
export PATH=
P
A
T
H
:
{PATH}:
PATH:{ANDROID_HOME}/tools
export PATH=
P
A
T
H
:
{PATH}:
PATH:{ANDROID_HOME}/platform-tools
2.3,安装flutter和dart插件
3,ios开发环境
3.1,下载xcode
3.2,运行flutter doctor 检查安装相关依赖
4,flutter常用命令
查看flutter环境搭建情况:flutter doctor
查看连接虚拟机:flutter emulators
查看连接设备:flutter devices
创建flutter项目:flutter create my_app cd my_app
确保虚拟机开启:flutter run
升级flutter版本:
在项目的根目录中运行:flutter upgrade
查看flutter渠道:flutter channels
渠道间的切换:flutter channel stable
pubspec.yaml文件掌管着flutter所需要的依赖包,类似于Node.js的package.json,这些Flutter依赖包有内置的,还有别的开发者发布的,可以通过“flutter packages upgrade“命令升级这些依赖包。
5,dart初体验
一共有两种体验dart编译运行的方法:
1,本地安装dart sdk(以mac电脑为例):
通常我们并不需要单独安装Dart SDK,flutter会自带(bin/cache/dart-sdk目录),并且会锁死flutter对应的dart版本。如果你想试用最新的功能,可以把flutter切到dev channel,dev channel没有锁死Dart版本,你可以自行替换
在bash_profile中进行配置
export DART_HOME="/Users/cixueting/Documents/flutter/flutter/bin/cache/dart-sdk/bin"
export PATH=
P
A
T
H
:
{PATH}:
PATH:{DART_HOME}
运行dart文件:
dart hello_world.dart
2,在线dart编辑器:https://repl.it/languages/dart
更多推荐
所有评论(0)