iOS+Flutter--FlutterBoost(一)
FlutterBoost链接:https://github.com/alibaba/flutter_boost
FlutterBoost是一个Flutter-Native的混合解决方案,可以轻松的为现有的原生项目提供混合Flutter的方案;FlutterBoost可以帮你处理页面的映射和跳转。
一、创建Flutter Module
确保与iOS项目在同一目录下,如图1:
图1终端下执行flutter create -t module FlutterBoostDemo,FlutterBoostDemo是指定的module名称,如图2:
图2二、添加Flutter_Boost依赖
修改FlutterBoostDemo目录下pubspec.yaml文件,添加如下代码,如图3:
flutter_boost:
git:
url: 'https://github.com/alibaba/flutter_boost.git'
ref: '1.12.13+1'
图3终端下进入FlutterBoostDemo目录,并执行flutter packages get获取FlutterBoost包,如图4:
图4三、原生项目接入Flutter_Boost
在Podfile中添加如下代码,如图5:
图5flutter_application_path = "../FlutterBoostDemo" load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') install_all_flutter_pods(flutter_application_path)
执行pod install,安装依赖,如图6:
图6至此FlutterBoost已经集成到iOS项目中了,下一章将介绍如何使用FlutterBoot实现Native与Flutter的交互。