Open Deathislikethewind opened 1 year ago
当调用webview_flutter调用create时,报错
_controller = WebViewController();
final ByteData? result = !kReleaseMode && debugProfilePlatformChannels ? await (binaryMessenger as _ProfiledBinaryMessenger).sendWithPostfix(name, '#$method', input) : await binaryMessenger.send(name, input); 这里的result返回的是null找不到create方法。
No implementation found for method create on channel flutter/platform_views
另外无法主副屏通讯的,可以尝试去FlutterSubscreenPlugin里自己手动改一下
onAttachedToActivity方法里的onSubFlutterEngineCreated方法不会被执行,所以要把里面的 FlutterSubScreenProvider.instance.flutterEngine?.let { engine -> onCreateViceChannel(engine.dartExecutor) }这个代码提到外面去,全部代码如下
override fun onAttachedToActivity(binding: ActivityPluginBinding) { //your plugin is now attached to an Activity val autoShowSubScreenWhenInit = context.resources.getBoolean(R.bool.autoShowSubScreenWhenInit) FlutterSubScreenProvider.instance.doInit(binding.activity, autoShowSubScreenWhenInit) FlutterSubScreenProvider.instance.flutterEngine?.let { engine -> onCreateViceChannel(engine.dartExecutor) } FlutterSubScreenProvider.instance.setFlutterSubCallback(object : IFlutterSubCallback { override fun onSubFlutterEngineCreated() { //副屏 engine 初始化后,将副屏事件进行分发 FlutterSubScreenProvider.instance.flutterEngine?.let { engine -> onCreateViceChannel(engine.dartExecutor) } } }) }
感谢提供方案,亲测好用 @Deathislikethewind
感谢反馈~ 1.0.8已修复
当调用webview_flutter调用create时,报错
_controller = WebViewController();
final ByteData? result = !kReleaseMode && debugProfilePlatformChannels ? await (binaryMessenger as _ProfiledBinaryMessenger).sendWithPostfix(name, '#$method', input) : await binaryMessenger.send(name, input); 这里的result返回的是null找不到create方法。
No implementation found for method create on channel flutter/platform_views
另外无法主副屏通讯的,可以尝试去FlutterSubscreenPlugin里自己手动改一下
onAttachedToActivity方法里的onSubFlutterEngineCreated方法不会被执行,所以要把里面的 FlutterSubScreenProvider.instance.flutterEngine?.let { engine -> onCreateViceChannel(engine.dartExecutor) }这个代码提到外面去,全部代码如下
override fun onAttachedToActivity(binding: ActivityPluginBinding) { //your plugin is now attached to an Activity val autoShowSubScreenWhenInit = context.resources.getBoolean(R.bool.autoShowSubScreenWhenInit) FlutterSubScreenProvider.instance.doInit(binding.activity, autoShowSubScreenWhenInit) FlutterSubScreenProvider.instance.flutterEngine?.let { engine -> onCreateViceChannel(engine.dartExecutor) } FlutterSubScreenProvider.instance.setFlutterSubCallback(object : IFlutterSubCallback { override fun onSubFlutterEngineCreated() { //副屏 engine 初始化后,将副屏事件进行分发 FlutterSubScreenProvider.instance.flutterEngine?.let { engine -> onCreateViceChannel(engine.dartExecutor) } } }) }