Using
//PlatformView: e.g: WebView
final screenshotController = NativeScreenshotController();
NativeScreenshot(
controller: screenshotController,
child: WebViewWidget(
controller: WebViewController()
..loadRequest(Uri.parse('https://flutter.dev')),
),
);
//take screenshot:
final imageBytes = await screenshotController.takeScreenshot();
//Flutter Widget
final screenshotController = NativeScreenshotController();
NativeScreenshot(
controller: screenshotController,
child: Text(
"Flutter Widget",
style: Theme.of(context).textTheme.titleLarge,
),
),
//take screenshot:
final imageBytes = await screenshotController.takeScreenshot();