getSize method Null safety

Future<Size?> getSize()

Gets the current size in pixels of the WebView.

Note that if the HeadlessInAppWebView is not running, this method will return null.

Implementation

Future<Size?> getSize() async {
  if (!_running) {
    return null;
  }

  Map<String, dynamic> args = <String, dynamic>{};
  Map<String, dynamic> sizeMap =
      (await _channel.invokeMethod('getSize', args))?.cast<String, dynamic>();
  return MapSize.fromMap(sizeMap);
}