methodCallhandler method
Implementation
Future<void> methodCallhandler(MethodCall call) async {
switch (call.method) {
case "urlChanged":
int browserId = call.arguments["browserId"] as int;
_webViews[browserId]
?.listener
?.onUrlChanged
?.call(call.arguments["url"] as String);
return;
case "titleChanged":
int browserId = call.arguments["browserId"] as int;
_webViews[browserId]
?.listener
?.onTitleChanged
?.call(call.arguments["title"] as String);
return;
case "onConsoleMessage":
int browserId = call.arguments["browserId"] as int;
_webViews[browserId]?.listener?.onConsoleMessage?.call(
call.arguments["level"] as int,
call.arguments["message"] as String,
call.arguments["source"] as String,
call.arguments["line"] as int);
return;
case 'javascriptChannelMessage':
int browserId = call.arguments['browserId'] as int;
_webViews[browserId]?.onJavascriptChannelMessage?.call(
call.arguments['channel'] as String,
call.arguments['message'] as String,
call.arguments['callbackId'] as String,
call.arguments['frameId'] as String);
return;
case 'onTooltip':
int browserId = call.arguments['browserId'] as int;
_webViews[browserId]?.onToolTip?.call(call.arguments['text'] as String);
return;
case 'onCursorChanged':
int browserId = call.arguments['browserId'] as int;
_webViews[browserId]
?.onCursorChanged
?.call(call.arguments['type'] as int);
return;
case 'onFocusedNodeChangeMessage':
int browserId = call.arguments['browserId'] as int;
bool editable = call.arguments['editable'] as bool;
_webViews[browserId]?.onFocusedNodeChangeMessage(editable);
return;
case 'onImeCompositionRangeChangedMessage':
int browserId = call.arguments['browserId'] as int;
_webViews[browserId]
?.onImeCompositionRangeChangedMessage
?.call(call.arguments['x'] as int, call.arguments['y'] as int);
return;
case 'onLoadStart':
int browserId = call.arguments["browserId"] as int;
String urlId = call.arguments["urlId"] as String;
await _injectUserScriptIfNeeds(browserId,
_injectUserScripts?.retrieveLoadStartInjectScripts() ?? []);
WebViewController controller =
_webViews[browserId] as WebViewController;
_webViews[browserId]?.listener?.onLoadStart?.call(controller, urlId);
return;
case 'onLoadEnd':
int browserId = call.arguments["browserId"] as int;
String urlId = call.arguments["urlId"] as String;
await _injectUserScriptIfNeeds(browserId,
_injectUserScripts?.retrieveLoadEndInjectScripts() ?? []);
WebViewController controller =
_webViews[browserId] as WebViewController;
_webViews[browserId]?.listener?.onLoadEnd?.call(controller, urlId);
return;
default:
}
}