setSize method Null safety

Future<void> setSize(
  1. Size size
)

Set the size of the WebView in pixels.

Set -1 to match the corresponding width or height of the current device screen size. Size(-1, -1) will match both width and height of the current device screen size.

Note that if the HeadlessInAppWebView is not running, this method won't have effect.

NOTE for Android: Size width and height values will be converted to int values because they cannot have double values.

Implementation

Future<void> setSize(Size size) async {
  if (!_running) {
    return;
  }

  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('size', () => size.toMap());
  await _channel.invokeMethod('setSize', args);
}