環(huán)境配置
https://flutter.cn/docs/get-started/install混編方式(2種優(yōu)缺點)
http://www.reibang.com/p/da7df2479326
- iOS混編flutter_moudle打包
cd 到flutter_module根目錄
flutter build ios-framework --cocoapods --output=some/path/MyApp/Flutter/
在pod中添加
pod 'Flutter', :podspec => 'some/path/MyApp/Flutter/[build mode]/Flutter.podspec'
之后再把xcframework拖入到項目中
- iOS
1.創(chuàng)建項目 pod 。
2.cd到項目目錄下 創(chuàng)建flutter包
flutter create -t module flutter_module
這里待確定涝影,不引用也不會有問題
//pubspec文件引入flutter_boost先鱼,我這里采用本地引入方式
flutter_boost:
path: flutter_boost-3.0-null-safety-release.2.1
4.podfile文件添加
flutter_application_path = './flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'NaviteMixinFlutterDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
install_all_flutter_pods(flutter_application_path)
# Pods for NaviteMixinFlutterDemo
end
- pod install 報錯
[!] InvalidPodfile
file: Missingflutter_post_install(installer)
in Podfilepost_install
block.
podfile文件添加
target 'myapp' do
// 用的各sdk
end
// 新增的配置
post_install do |installer|
flutter_post_install(installer) if defined?(flutter_post_install)
end
- Android
1.在原生的項目同級目錄中添加flutter_moudle.
2.app下的build.gradle文件中添加以下配置
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
3.在項目根目錄下的setting.gradle文件中配置:
my_flutter為創(chuàng)建的flutter包明進(jìn)行替換
include ':app'
// 加入下面配置
setBinding(new Binding([gradle: this]))
evaluate(new File(
settingsDir.parentFile,
'my_flutter/.android/include_flutter.groovy'
))
https://www.imgeek.net/article/825361249
-- 安卓的介入
https://www.codenong.com/jsd6d7f92952b3/
- 消息傳遞方式
http://www.manongjc.com/detail/32-goutfjdszcawkju.html
https://cloud.tencent.com/developer/article/1415022?from=15425&areaSource=102001.1&traceId=NCEe5aoEbJUjV9gFlMGdx
三種原生和flutter交互方式
https://blog.csdn.net/china_2014/article/details/111992010