run method

Future<void> run()

Runs the headless WebView.

Implementation

Future<void> run() async {
  if (_started) {
    return;
  }
  _started = true;
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('id', () => id);
  args.putIfAbsent(
      'params',
      () => <String, dynamic>{
            'initialUrlRequest': this.initialUrlRequest?.toMap(),
            'initialFile': this.initialFile,
            'initialData': this.initialData?.toMap(),
            'initialOptions': this.initialOptions?.toMap() ?? {},
            'contextMenu': this.contextMenu?.toMap() ?? {},
            'windowId': this.windowId,
            'implementation': this.implementation.toValue(),
            'initialUserScripts':
                this.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
            'pullToRefreshOptions':
                this.pullToRefreshController?.options.toMap() ??
                    PullToRefreshOptions(enabled: false).toMap(),
            'initialSize': this.initialSize.toMap()
          });
  await _sharedChannel.invokeMethod('run', args);
  _running = true;
}