removeJavascriptChannels method

  1. @override
Future<void> removeJavascriptChannels(
  1. Set<String> javascriptChannelNames
)

Removes JavaScript channel names from the set of enabled channels.

This disables channels that were previously enabled by addJavascriptChannels or through CreationParams.javascriptChannelNames.

Implementation

@override
Future<void> removeJavascriptChannels(
  Set<String> javascriptChannelNames,
) {
  return Future.wait(
    javascriptChannelNames.where(
      (String channelName) {
        return _javaScriptChannels.containsKey(channelName);
      },
    ).map<Future<void>>(
      (String channelName) {
        final WebViewAndroidJavaScriptChannel javaScriptChannel =
            _javaScriptChannels[channelName]!;
        _javaScriptChannels.remove(channelName);
        return webView.removeJavaScriptChannel(javaScriptChannel);
      },
    ),
  );
}