Skip to content

In webview_platform, UnimplementedError: createPlatformNavigationDelegate is not implemented on the current platform. #157687

@mosil

Description

@mosil

Steps to reproduce

In my project I use the libreary webview_flutter_web 0.2.3+2.
When I impletement it in my project and run on chrome

I got the log: createPlatformNavigationDelegate is not implemented on the current platform.
So, I try implement it in main function

WebViewPlatform.instance = WebWebViewPlatform();
WebViewPlatform.instance!.createPlatformNavigationDelegate(PlatformNavigationDelegateCreationParams());

It's show same log.

Expected results

I wanted it to run normally in chrome or the browser on the mobile phone, and then monitor its onstart or onFinished during loadRequest.

Actual results

Get log:
DartError: UnimplementedError: createPlatformNavigationDelegate is not implemented on the current platform.

Code sample

Code sample
// declare PlatformWebViewController
PlatformWebViewController controller = PlatformWebViewController(
      const PlatformWebViewControllerCreationParams(),
    )
      ..setPlatformNavigationDelegate(
        PlatformNavigationDelegate(
          const PlatformNavigationDelegateCreationParams(),
        )
          ..setOnPageStarted((url) {
            print("..........setOnPageStarted");
          })
          ..setOnProgress((progress) {
            print("..........setOnProgress");
          })
          ..setOnPageFinished(
            (url) {
              print("..........setOnPageFinished");
              // I need get something in url, in this stage
              });
            },
          ),
      )
      ..loadRequest(params);

...
// use PlatformWebView on  page widget, run it on chrome
PlatformWebViewWidget(PlatformWebViewWidgetCreationParams(controller: controller)).build(context)

Screenshots or Video

No response

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-arm64, locale zh-Hant-TW)
    • Flutter version 3.24.3 on channel stable at /Users/mosil/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (7 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android Studio (version 2024.2)
    • Android Studio at /Users/mosil/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] Connected device (5 available)
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 130.0.6723.70

[✓] Network resources
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: webviewThe WebView pluginpackageflutter/packages repository. See also p: labels.platform-webWeb applications specificallyr: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions