flutter-webview-windows icon indicating copy to clipboard operation
flutter-webview-windows copied to clipboard

Error running the project in the child window

Open vusarath opened this issue 1 year ago • 2 comments

Using desktop_multi_window package crated a new window from a flutter windows application and when created and opened new window with this browser component it fails with this error

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel io.jns.webview.win) #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)

https://github.com/jnschulze/flutter-webview-windows/issues/1 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:518:43)

https://github.com/jnschulze/flutter-webview-windows/issues/2 WebviewController.initialize (package:webview_windows/src/webview.dart:172:11)

Any thing i missed or any suggestions.

vusarath avatar Jan 04 '24 12:01 vusarath

@vusarath Hi, any chance you managed to solve this?

AkkiG2401 avatar Oct 05 '24 08:10 AkkiG2401

If you need to use a plugin within a sub-window, you must manually register it in main.cpp or flutter_window.cpp when the sub-window is created.

The code you provided demonstrates the correct method for this: DesktopMultiWindowSetWindowCreatedCallback([](void *controller) { auto *flutter_controller_sub_ = reinterpret_cast<flutter::FlutterViewController *>(controller); auto *registry = flutter_controller_sub_->engine(); // Manual registration of native plugins for the sub-window WindowManagerPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("WindowManagerPlugin")); FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi")); ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi")); DesktopDropPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("DesktopDropPlugin")); WebviewWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("WebviewWindowsPlugin")); });

W2XiaoYu avatar Sep 11 '25 08:09 W2XiaoYu