1.第一步,开发环境搭建
开发语言:https://www.dartcn.com/
https://flutterchina.club/get-started/install/
大厂出品就是不一样,不象某信,开发某小程序居然不支持linux系统
我用的是linux系统
https://flutterchina.club/setup-linux/
由于在国内访问Flutter有时可能会受到限制,Flutter官方为中国开发者搭建了临时镜像,大家可以将如下环境变量加入到用户环境变量中:
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
vi /etc/profile
修改用户环境变量
github项目地址https://github.com/flutter/flutter
安装包地址 https://github.com/flutter/flutter/releases
可以看到flutter的更新速度还是很快的,我们这里就以最新的为例子吧
下载最新的包
/dev$ wget https://github.com/flutter/flutter/archive/1.18.0-11.1.pre.tar.gz
解压
tar -zxvf xxx
添加flutter
相关工具到path中:
...
算了,以上作废,当我没写
重新开始,我们安装稳定版本、
https://github.com/flutter/flutter/tree/stable
https://flutter.dev/docs/get-started/install/linux
下载稳定版本
wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.17.1-stable.tar.xz
解压
tar xf flutter_linux_1.17.1-stable.tar.xz
配置环境变量
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/home/yangyang/下载/dev/flutter/bin:$PATH
source /etc/profile
验证
flutter doctor
上面显示有2个问题需要解决,按照他说的去做就好了
flutter doctor --android-licenses
再次验证
解决下一个问题,这个也很明显,flutter和dart插件没有安装
Flutter plugin not installed; this adds Flutter specific functionality.
安装相关插件即可
在测试验证一下
okokokojbk.....
直接按教程来就可以了
创建一个新的flutter项目
okokokojbk
运行错误
添加一下地址
资源下载不下来,看来镜像没有设置好。
ok.可以了,就是下载不到而已
写在后面,如何升级
https://flutterchina.club/upgrading/
开发桌面程序
https://www.jianshu.com/p/1344d6916b04
flutter channel
flutter channel master
flutter upgrade
flutter config --enable-macos-desktop
flutter config --enable-linux-desktop
flutter config --enable-windows-desktop
以上修改完成后,在你的flutter本地配置文件中也会被对应修改(一般是用户名目录下的.flutter_settings
)如下图:
查看本地模拟器 flutter devices
为了支持windows linux macos,需要重新设置flutter环境
解决问题
sudo apt install clang
sudo apt install cmake
sudo apt install ninja-build
打包
$: flutter build macos
$: flutter build linux
$: flutter build windows
$: flutter build ios
$: flutter build apk
添加忽略文件