takeScreenshot method
Takes a screenshot of the WebView's visible viewport and returns a Uint8List. Returns null
if it wasn't be able to take it.
screenshotConfiguration
represents the configuration data to use when generating an image from a web view’s contents.
NOTE for iOS: available on iOS 11.0+.
NOTE for MacOS: available on MacOS 10.13+.
Officially Supported Platforms/Implementations:
- Android native WebView
- iOS (Official API - WKWebView.takeSnapshot)
- MacOS (Official API - WKWebView.takeSnapshot)
- Windows
Implementation
@override
Future<Uint8List?> takeScreenshot(
{ScreenshotConfiguration? screenshotConfiguration}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent(
'screenshotConfiguration', () => screenshotConfiguration?.toMap());
return await channel?.invokeMethod<Uint8List?>('takeScreenshot', args);
}