onJavascriptChannelMessage method

void onJavascriptChannelMessage(
  1. String channel,
  2. String message
)

Invoked when a JavaScript channel message is received.

Implementation

void onJavascriptChannelMessage(String channel, String message) {
  final JavascriptChannel? javascriptChannel = channels[channel];

  if (javascriptChannel == null) {
    throw ArgumentError('No channel registered with name $channel.');
  }

  javascriptChannel.onMessageReceived(JavascriptMessage(message));
}