setSize method

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 PlatformHeadlessInAppWebView is not running, this method won't have effect.

Officially Supported Platforms/Implementations:

  • Android WebView:
    • Size width and height values will be converted to int values because they cannot have double values.
  • iOS WKWebView
  • macOS WKWebView
  • Web <iframe>
  • Linux WPE WebKit

Parameters - Officially Supported Platforms/Implementations:

  • size: all platforms

Use the PlatformHeadlessInAppWebView.isMethodSupported method to check if this method is supported at runtime.

Implementation

Future<void> setSize(Size size) => platform.setSize(size);