getHtml method

Future<String?> getHtml()

Gets the content html of the page. It first tries to get the content through javascript. If this doesn't work, it tries to get the content reading the file:

  • checking if it is an asset (file:///) or
  • downloading it using an HttpClient through the WebView's current url.

Returns null if it was unable to get it.

Officially Supported Platforms/Implementations:

  • Android WebView
  • iOS WKWebView
  • Linux WPE WebKit:
    • This method is implemented using JavaScript.
  • macOS WKWebView
  • Web <iframe> but requires same origin
  • Windows WebView2

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

Implementation

Future<String?> getHtml() => platform.getHtml();