Flutter 引入 iOS
集成方案
混合开发 - 一定需要 flutter
项目 与 原生开发的隔离, 否则引入的话免谈!!!
所以以下的相关文章都是在这个基础上讨论的
项目隔离, 但是依赖 Flutter 与 原生开发环境
- 闲鱼-flutter_boost 整个
Flutter
相关生命周期管理, 但是有侵入性
项目完全隔离, 且直接拉取原生依赖, 不需要配置 Flutter
环境
- Flutter集成初体验 有不少实践中的解决方案
- 闲鱼 | 这招Flutter混合工程改造,却好用到爆
- 头条 Flutter iOS 混合工程实践
- Flutter混合开发组件化与工程化架构
- 从零搭建 iOS Native Flutter 混合工程 主要是利用脚本,将原生所依赖的
Flutter
产物 自动化集成 当然发布flutter
产物的话,需要本地有Flutter
环境, 执行Flutter
相关脚本 和 原生相关脚本 - Flutter开发干货!关于Flutter和已有App混合开发的一些个人思考和探索
前端 web
问题
社区
- flutter
- awesome-flutter
- FlutterExampleApps
- FlutterDouBan 豆瓣示例
- ios-flutter 官方
- Flutter中文网
- 闲鱼公众号
- 掘金 flutter
环境配置
flutter SDK
- 下载压缩包
- 解压到 用户根目录, 即 解压后的路径为
~/flutter
- 配置环境变量
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=$HOME/flutter/bin:$PATH
检查环境配置情况
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
✗ Android SDK file not found: /Users/adventure/Library/Android/sdk/platforms/android-29/android.jar.
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
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
[!] Android Studio (version 3.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2018.1.6)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.34.0)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
! Doctor found issues in 5 categories.
配置 安卓环境
Android SDK file not found
- java 虚拟机环境
- 安卓 sdk Mac下配置Android开发环境
再次执行 flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
[!] Android Studio (version 3.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2018.1.6)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.34.0)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
剩下的就是 IDE
的插件安装了, 打开相应的 软件 -> 配置 -> plugin -> 搜索 flutter
安装即可
最后 当当当当 !
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.5 18F132, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
[✓] Android Studio (version 3.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.6)
[✓] VS Code (version 1.35.1)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.