Flutter学习
安装flutter,下载之后执行flutter doctor报 flutter: command not found错误,
解决方法:
1、在命令行输入 sudo vi ~/.bash_profile,然后在里面按i插入,
在文本输入:
export PATH=/flutter文件夹所在目录/flutter/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
编辑完之后,按ESC键,输入:wq,保存退出了;
2、 执行source ~/.bash_profile,这一步很重要,否则上面配置文件虽然有了,但是没有生效。
3、.配置文件生效后,flutter doctor报 The Flutter directory is not a clone of the GitHub project. 错误。
4、删除flutter文件夹然后直接在命令行输入:
git clone -b beta https://github.com/flutter/flutter.git
5、执行flutter doctor无报错。
第二种方法:
在.bash_profile文本输入
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
git clone -b dev https://github.com/flutter/flutter.git
export PATH="$PWD/flutter/bin:$PATH"