getSize method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform(), WebPlatform(requiresSameOrigin: false), LinuxPlatform()])
Future<Size?> getSize()

Gets the current size in pixels of the WebView.

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

Officially Supported Platforms/Implementations:

  • Android WebView
  • iOS WKWebView
  • macOS WKWebView
  • Web <iframe>
  • Linux WPE WebKit

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

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(),
    IOSPlatform(),
    MacOSPlatform(),
    WebPlatform(requiresSameOrigin: false),
    LinuxPlatform(),
  ],
)
Future<Size?> getSize() {
  throw UnimplementedError(
    'getSize is not implemented on the current platform',
  );
}