WHS GIS Engineer

Flutter从入门到放弃

2019-07-25
WHS

Flutter是Google推出的跨平台的SDK,可通过单一代码库为移动,网络和台式机打造精美,快速的用户体验。Flutter可与现有代码配合使用,为世界各地的开发人员和组织所使用,并且是免费的开放源代码。

开发环境搭建

  1. 安装
  2. 常用命令
    # 配置镜像
    export PUB_HOSTED_URL=https://pub.flutter-io.cn
    export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
    # 检查
    flutter doctor
    # 查看flutter 处于什么分支上
    flutter channel 
    # 切换分支
    flutter channel master
    # 启用web配置
    flutter config --enable-web
    # 更新
    flutter upgrade
    # 安装包
    flutter pub get
    # 创建一个module
    cd some/path/
    flutter create -t module --org com.example my_flutter
    # 检查Android许可
    flutter doctor --android-licenses
    # clean
    flutter clean
    # run
    flutter run -v
    # 检查发布文件
    flutter packages pub publish --dry-run
    # 发布包
    flutter packages pub publish
    

常用知识点

Debugger Flutter的Future异步详解 插件开发 图解 Flutter 基本动画 (一)

常用包和插件

官方维护的组件库

AS插件

  • FlutterJsonBeanFactory json转对象

    常见问题

  • 更新失败
...nloading Dart SDK from Flutter engine b863200c37df4ed378042de11c4e9ff34e4e58c9
curl: (3) URL using bad/illegal format or missing URL

Failed to retrieve the Dart SDK from: https://storage.googleapis.com/flutter_infra/flutter/b863200c37df4ed378042de11c4e9ff/dart-sdk-darwin-x64.zip
If you're located in China, please see this page:
  https://flutter.dev/community/china

需要将Dart SDK 解压到Flutter安装目录下

  • gradle构建失败 ``` Process ‘command ‘/Users/whs/Flutter_workspace/flutter/bin/flutter’’ finished with non-zero exit value 1

``` flutter run -v 查看原因 androidx 和 support库冲突

相关资源

  • Flutter Rendering
  • Flutter Engine
  • Documentation: https://docs.flutter.io/
  • Github: https://github.com/flutter/flutter
  • StackOverflow: https://stackoverflow.com/questions/tagged/flutter
  • Gitter: https://gitter.im/flutter/flutter Effective Dart Guide: https://www.dartlang.org/guides/language/effective-dart
  • Dart Tips: https://www.dartlang.org/resources/dart-tips
  • Flutter FAQ: https://flutter.io/faq/
  • Flutter Rendering:
  • Hot Reload
  • Flutter Inspector: https://dart-lang.github.io/observatory/
  • Dart Style Guide: https://www.dartlang.org/guides/language/effective-dart/style
  • Dart Observatory: https://dart-lang.github.io/observatory/
  • Flutter Widgets: https://flutter.io/widgets/
  • Flutter Gallery App Code: https://github.com/flutter/flutter/tree/master/examples/flutter_gallery
  • Flutter Gallery Android App: https://play.google.com/store/apps/details?id=io.flutter.demo.gallery
  • Flutter Layout: https://flutter.io/tutorials/layout/
  • Material: https://material.io
  • Icons: https://thenounproject.com
  • Images: https://unsplash.com
  • Fonts: https://fonts.google.com
  • Google APIs: https://pub.dartlang.org/packages/googleapis
  • Async and Futures: https://www.dartlang.org/tutorials/language/futures
  • Testing: https://flutter.io/testing/

Comments