open method
Opens the ChromeSafariBrowser instance with an url
.
url
: The url
to load.
options
: Options for the ChromeSafariBrowser.
Implementation
Future<void> open(
{required Uri url, ChromeSafariBrowserClassOptions? options}) async {
assert(url.toString().isNotEmpty);
this.throwIsAlreadyOpened(message: 'Cannot open $url!');
List<Map<String, dynamic>> menuItemList = [];
_menuItems.forEach((key, value) {
menuItemList.add({"id": value.id, "label": value.label});
});
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('id', () => id);
args.putIfAbsent('url', () => url.toString());
args.putIfAbsent('options', () => options?.toMap() ?? {});
args.putIfAbsent('menuItemList', () => menuItemList);
await _sharedChannel.invokeMethod('open', args);
this._isOpened = true;
}