Skip to content

[Documentation] Sample code of addJavaScriptChannel of webview_flutter is incorrect. #132727

@your-diary

Description

@your-diary

The documentation shows this sample code but this doesn't compile.

final WebViewController controller = WebViewController();
controller.addJavaScriptChannel(
  name: 'Print',
  onMessageReceived: (JavascriptMessage message) {
    print(message.message);
  },
);

Here's the correct version.

final WebViewController controller = WebViewController();
controller.addJavaScriptChannel(
  'Print', //should be a positional parameter
  onMessageReceived: (JavaScriptMessage message) { //Java"S"criptMessage (not Java"s"criptMessage)
    print(message.message);
  },
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/p: webviewThe WebView pluginpackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions