一、环境配置
1.开发工具3.0以上Android studio
2.执行git命令下载flutter SDK
①.配置flutter环境变量
PUB_HOSTED_URL=https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
国内镜像(
上海交通大学 Linux 用户组
FLUTTER_STORAGE_BASE_URL: https://mirrors.sjtug.sjtu.edu.cn
PUB_HOSTED_URL: https://dart-pub.mirrors.sjtug.sjtu.edu.cn
Flutter 社区
FLUTTER_STORAGE_BASE_URL: https://storage.flutter-io.cn
PUB_HOSTED_URL: https://pub.flutter-io.cn
)
git init
git clone https://github.com/flutter/flutter.git
②.安装flutterSDK
找到flutter\bin下的flutter_console.bat双击
执行 flutter doctor
使用flutter --version 查看一下版本号
(如果只输入flutter 或者输入flutter -version, 那么flutter以为是下达了自动更新命令,会自动更新最新版本,这个一定要注意了)
要同时更新Flutter SDK和包,请使用以下命令 (不更新Flutter的就跳过此步):flutter upgrade把flutter的sdk安装目录下的flutter\bin放到环境变量的Path路径中
③.studio下载flutter、dart插件,并安装配置dart和flutter的sdk路径(flutter插件可以提高 Flutter 在开发过程中的开发效率(运行,调试,热重载等等)。dart插件提提升了代码层面的开发效率(在你敲代码的同时进行代码校验,代码自动补全等等)
flutter的SDK路径F:\xxx\flutter
dart的SDK路径F:\xxx\flutter\bin\cache\dart-sdk
3.开始项目
新建:File->New下已经显示New Flutter Project
导入:File—>Open,选中Flutter根目录导入,如果有问题,可以先在Flutter根目录运行一下命令:flutter run来完善项目环境,然后重新导入如果有问题,可以先在Flutter根目录运行一下命令:flutter run来完善项目环境,然后重新导入
4.学习链接
flutter中文官网:http://doc.flutter-dev.cn/get-started
flutter英文官网:https://flutter.io/docs/get-started
闲鱼技术:https://www.yuque.com/xytech/flutter
Dart2中文文档:https://www.kancloud.cn/marswill/dark2_document/709087
Flutter 高仿知乎UI:https://github.com/HackSoul/zhihu-flutter
干货集中营 客户端 flutter版:
https://github.com/ZQ330093887/GankFlutter
https://github.com/txy199292/gank_io
flutter自定义波浪view:https://github.com/While1true/WaveView_flutter
仿网易云音乐:https://github.com/boyan01/quiet-flutter
高仿书旗小说 Flutter版:https://github.com/huanxsd/flutter_shuqi
其他:
https://github.com/yang7229693/flutter-study
https://github.com/hnvn/flutter_shimmer
https://github.com/serenader2014/flutter_carousel_slider
https://github.com/amangautam1/flutter-musicplayer
问题:
不显示new Flutter Project菜单:https://www.jianshu.com/p/ebaf065d7b1c
adb连接不上:https://blog.csdn.net/shengmer/article/details/79027828
dart语言:
一、变量
1.在变量名前增加下划线 _ 来标记为它是私有的
2.在 Dart 2 中,new 关键字变成了可选的。如果你确信某个变量的值不会再发生改变,你可以使用 final 来代替 var
3.未初始化的变量(即使是数字类型的变量)的值都为 null
4.Dart 并不支持构造函数的重载,而是使用可选参数
Rectangle({this.origin = const Point(0, 0), this.width = 0, this.height = 0});
await
关键字必须在async
函数内部使用async
函数必须使用await
关键字