openUrlRequest method
Future<void>
openUrlRequest({
- required URLRequest urlRequest,
- InAppBrowserClassOptions? options,
inherited
Opens the InAppBrowser
instance with an urlRequest
.
urlRequest
: The urlRequest
to load.
options
: Options for the InAppBrowser
.
Implementation
Future<void> openUrlRequest(
{required URLRequest urlRequest,
InAppBrowserClassOptions? options}) async {
this.throwIfAlreadyOpened(message: 'Cannot open $urlRequest!');
assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty);
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('id', () => id);
args.putIfAbsent('urlRequest', () => urlRequest.toMap());
args.putIfAbsent('options',
() => options?.toMap() ?? InAppBrowserClassOptions().toMap());
args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {});
args.putIfAbsent('windowId', () => windowId);
args.putIfAbsent('implementation', () => implementation.toValue());
args.putIfAbsent('initialUserScripts',
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
args.putIfAbsent(
'pullToRefreshOptions',
() =>
pullToRefreshController?.options.toMap() ??
PullToRefreshOptions(enabled: false).toMap());
await _sharedChannel.invokeMethod('open', args);
}