commit | ac644776a28b52e0952794629828f5e8304a6ea0 | [log] [tgz] |
---|---|---|
author | Amir Hardon <amirh@users.noreply.github.com> | Mon Feb 04 12:57:33 2019 -0800 |
committer | GitHub <noreply@github.com> | Mon Feb 04 12:57:33 2019 -0800 |
tree | 48426ef9f182a764cded366112d8712a4811d785 | |
parent | 7d494b433f7aab6d702e5a412a6cce3be1e77956 [diff] |
Add WebView JavaScript channels (Dart side). (#1116) Allows JavaScript code running in the WebView to send messages that will be received by the Flutter app's Dart code. To keep the PRs smaller this does not include the platform side implementations which will be sent in following PRs. Right now there are no return values on the JavaScript side, we could think of returning a JavaScript promise (or a promise equivalent) in the future, but as a first step I start without it (`evaluateJavascript` can be used to pass messages in the other direction so this shouldn't be a blocking limitation). I believe that if we end up adding a return value on the JavaScript side this could be done without making a breaking change. ### Sample usage Dart: ```dart WebView( javascriptChannels: <JavascriptChannel>[ JavascriptChannel(name: 'Print', onMessageReceived: (String msg) {print(msg); }), ].toSet(), ), ``` JavaScript (running inside the WebView): ```javascript Print.postMessage('Hello!'); ``` Fixes: https://github.com/flutter/flutter/issues/24837
This repo is a companion repo to the main flutter repo. It contains the source code for Flutter first-party plugins (i.e., plugins developed by the core Flutter team). Check the packages
directory for all plugins.
Flutter plugins enable access to platform-specific APIs. For more information about plugins, and how to use them, see https://flutter.io/platform-plugins/.
These plugins are also available on pub.
Please file any issues, bugs, or feature requests in the main flutter repo.
If you wish to contribute a new plugin to the Flutter ecosystem, please see the documentation for developing packages and platform channels. You can store your plugin source code in any GitHub repository (the present repo is only intended for plugins developed by the core Flutter team). Once your plugin is ready you can publish to the pub repository.
If you wish to contribute a change to any of the existing plugins in this repo, please review our contribution guide, and send a pull request.
These are the available plugins in this repository.
Learn more about FlutterFire.