call method
Implementation
@override
Object? call(Interpreter interpreter, List<Object?> arguments,
Map<Symbol, Object?> namedArguments) {
String? initialUrl;
var initialUrlParsed = namedArguments[const Symbol('initialUrl')];
if (initialUrlParsed != null) {
initialUrl = initialUrlParsed as String;
}
JavascriptMode javascriptMode = JavascriptMode.disabled;
var javascriptModeParsed = namedArguments[const Symbol('javascriptMode')];
if (javascriptModeParsed != null) {
javascriptMode = javascriptModeParsed as JavascriptMode;
}
Function(String)? onPageStarted;
var onPageStartedParsed = namedArguments[const Symbol('onPageStarted')];
if (onPageStartedParsed != null) {
onPageStarted = (s) {
(onPageStartedParsed as LoxFunction).call(interpreter, [s], {});
};
}
Function(String)? onPageFinished;
var onPageFinishedParsed = namedArguments[const Symbol('onPageFinished')];
if (onPageFinishedParsed != null) {
onPageFinished = (s) {
(onPageFinishedParsed as LoxFunction).call(interpreter, [s], {});
};
}
bool debuggingEnabled = false;
var debuggingEnabledParsed =
namedArguments[const Symbol('debuggingEnabled')];
if (debuggingEnabledParsed != null) {
debuggingEnabled = debuggingEnabledParsed as bool;
}
String? userAgent;
var userAgentParsed = namedArguments[const Symbol('userAgent')];
if (userAgentParsed != null) {
userAgent = userAgentParsed as String;
}
bool zoomEnabled = true;
var zoomEnabledParsed = namedArguments[const Symbol('zoomEnabled')];
if (zoomEnabledParsed != null) {
zoomEnabled = zoomEnabledParsed as bool;
}
Color? backgroundColor;
var backgroundColorParsed = namedArguments[const Symbol('backgroundColor')];
if (backgroundColorParsed != null) {
backgroundColor = backgroundColorParsed as Color;
}
Function(WebViewController)? onWebViewCreated;
var onWebViewCreatedParsed =
namedArguments[const Symbol('onWebViewCreated')];
if (onWebViewCreatedParsed != null) {
onWebViewCreated = (WebViewController s) {
(onWebViewCreatedParsed as LoxFunction)
.call(interpreter, [WebViewControllerIns(s)], {});
};
}
Function(WebResourceError)? onWebResourceError;
var onWebResourceErrorParsed =
namedArguments[const Symbol('onWebResourceError')];
if (onWebResourceErrorParsed != null) {
onWebResourceError = (s) {
(onWebResourceErrorParsed as LoxFunction).call(interpreter, [s], {});
};
}
Set<JavascriptChannel>? javascriptChannels;
var javascriptChannelsParsed =
namedArguments[const Symbol('javascriptChannels')];
if (javascriptChannelsParsed != null) {
javascriptChannels =
(javascriptChannelsParsed as List).cast<JavascriptChannel>().toSet();
}
if (kIsWeb) return const Text("Webview only support on iOS and android");
return WebView(
initialUrl: initialUrl,
javascriptMode: javascriptMode,
javascriptChannels: javascriptChannels,
onPageStarted: onPageStarted,
onPageFinished: onPageFinished,
debuggingEnabled: debuggingEnabled,
userAgent: userAgent,
backgroundColor: backgroundColor,
zoomEnabled: zoomEnabled,
onWebViewCreated: onWebViewCreated,
onWebResourceError: onWebResourceError,
);
}