Flutter Google 更新跟进
Dart 语言
https://book.flutterchina.club/chapter1/dart.html
Dart SDK
http://dart.goodev.org/install/mac
中文社区
https://flutterchina.club/setup-macos/
https://flutter.io/docs/development/tools/sdk/archive?tab=macos#macos
Flutter 教程
https://juejin.im/post/5c0db59f6fb9a049bb7c2810
http://jspang.com/post/flutter1.html
https://flutter.io/docs/cookbook
https://flutter.io/docs/get-started/codelab
https://flutterchina.club/get-started/learn-more/
视频教程
阿里巴巴为大家学习Flutter操碎了心
https://github.com/zcwfeng/flutter-go
Flutter 文档和部署
https://flutter.cn/posts/launching-flutter-12-at-mobile-world.html
Flutter 环境配置
macos
.bash_profile
export FLUTTER_HOME="/Users/zcw/dev/flutter"
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=${FLUTTER_HOME}/bin:...:${PATH}
执行 flutter doctor
想要配置flutter web需要加入 Dart Sdk内置在Flutter的环境变量
export DART_HOME=/Users/admin/workspace_temp/flutter/bin/cache/dart-sdk/bin
我的个人环境变量
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export MONO_HOME=/Library/Frameworks/Mono.framework/Versions/6.4.0
export ANDROID_HOME=/Users/admin/Library/Android/sdk
export FLUTTER_HOME=/Users/admin/workspace_temp/flutter
export DART_HOME=/Users/admin/workspace_temp/flutter/bin/cache/dart-sdk/bin
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$JAVA_HOME/bin:$MONO_HOME/bin:$FLUTTER_HOME/bin:$HOME/.pub-cache/bin:${DART_HOME}:$PATH:.
export LANG=zh_CN.UTF-8
export LC_ALL=en_US.UTF-8
这里需要注意一下,如果没有用flutter自带的dart-sdk而是单独安装,这里可能会因为dart版本与flutter版本不匹配而出现如下提示
Can't load Kernel binary: Invalid kernel binary format version.
No active package webdev.
出现这种情况把dart卸载
brew uninstall dart
然后如前边所述将flutter内置的dart-sdk添加到环境变量就可以了。
启用flutter_web
flutter config --enable-web
出现如下提示
Setting "enable-web" value to "true".
接下来创建一个flutter项目
flutter create myapp
cd myap
可以看见目录下多了一个web文件夹里边是一个index.html
先看一下已连接的设备
➜ myapp flutter devices
3 connected devices:
macOS • macOS • darwin-x64 • Mac OS X 10.14.5 18F132
Chrome • chrome • web-javascript • Google Chrome 76.0.3809.132
Server • web • web-javascript • Flutter Tools
在chrome里跑一下项目
flutter run -d chrome
包导入管理和总结
- 网页查询
- https://pub.dartlang.org/packages/
- https://pub.dartlang.org/packages/url_launcher
- https://flutterchina.club/using-packages/
- https://flutterchina.club/developing-packages/
import 'package:flutter/material.dart';
import 'package:css_colors/css_colors.dart';
import 'package:flutter/animation.dart';
import 'package:url_launcher/url_launcher.dart';
- 用过的库
CSSColors ----> https://flutterchina.club/using-packages/#css-example
- pubspec.yaml 文件
dependencies:
url_launcher: '>=0.1.2 <0.2.0'
collection: '^0.1.2'
css_colors: ^1.0.0
iOS 相关
https://flutter.io/docs/get-started/install/macos
some times need fix:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
vscode 运行getpackage 出错
解决办法用命令行:
flutter packages get
github 开源资料
https://github.com/flutterchina
社区
https://flutterchina.club/app/gm.html
用到的核心
- skia https://skia.org/ (ios 没有打在包里,android系统自带)
- Dart https://pub.flutter-io.cn/
- JIT和AOT。
程序主要有两种运行方式:静态编译与动态解释。静态编译的程序在执行前全部被翻译为机器码,通常将这种类型称为AOT (Ahead of time)即 “提前编译”;
而解释执行的则是一句一句边翻译边运行,通常将这种类型称为JIT(Just-in-time)即“即时编译”。
AOT程序的典型代表是用C/C++开发的应用,它们必须在执行前编译成机器码,
而JIT的代表则非常多,如JavaScript、python等,事实上,所有脚本语言都支持JIT模式。
但需要注意的是JIT和AOT指的是程序运行方式,和编程语言并非强关联的,有些语言即可以以JIT方式运行也可以以AOT方式运行,如Java、Python,它们可以在第一次执行时编译成中间字节码、然后在之后执行时可以直接执行字节码,也许有人会说,中间字节码并非机器码,在程序执行时仍然需要动态将字节码转为机器码,是的,这没有错,不过通常我们区分是否为AOT的标准就是看代码在执行之前是否需要编译,只要需要编译,无论其编译产物是字节码还是机器码,都属于AOT。
在此,读者不必纠结于概念,概念就是为了传达精神而发明的,只要读者能够理解其原理即可,得其神忘其形。
Flutter 相关教程整理
https://blog.csdn.net/m0_37667770/article/details/80903890
https://github.com/MeandNi/Flutter_ZhiHu.git
https://github.com/flutterchina/flukit
https://github.com/flutterchina/dio
https://github.com/flutterchina
https://flutter-io.cn/docs/get-started/flutter-for/android-devs
官方实例
https://flutter-io.cn/docs/cookbook
官方动画实例
https://github.com/2d-inc/Flare-Flutter
游戏引擎
https://www.jianshu.com/p/6b11cb9d40c2
https://mp.weixin.qq.com/s/iC3HvgkkHLNa-kbEonXPLA
第三方book文档
https://book.flutterchina.club
https://flutterappdev.com/2019/02/01/color-picker-for-flutter-mobile-app-development-easy/