getHtml method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(), IOSPlatform(), LinuxPlatform(note: 'This method is implemented using JavaScript.'), MacOSPlatform(), WebPlatform(), WindowsPlatform()])
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
HttpClientthrough 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
@SupportedPlatforms(
platforms: [
AndroidPlatform(),
IOSPlatform(),
LinuxPlatform(note: 'This method is implemented using JavaScript.'),
MacOSPlatform(),
WebPlatform(),
WindowsPlatform(),
],
)
Future<String?> getHtml() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.getHtml.name} is not implemented on the current platform',
);
}