screenshot method
Parameters:
format
: Specify screenshot type, can be eitherScreenshotFormat.jpeg
orScreenshotFormat.png
. Defaults to 'png'.quality
: The quality of the image, between 0-100. Not applicable topng
images.fullPage
: When true, takes a screenshot of the full scrollable page. Defaults tofalse
.clip
: a Rectangle which specifies clipping region of the page.omitBackground
: Hides default white background and allows capturing screenshots with transparency. Defaults tofalse
.captureBeyondViewport
: Capture the screenshot beyond the viewport. When false, cuts the screenshot by the viewport size. Defaults totrue
.fromSurface
: Captures screenshot from the surface rather than the view. When false, works only in headful mode and ignores page viewport (but not browser window's bounds). Defaults totrue
.
Returns: Future which resolves to a list of bytes with captured screenshot.
NOTE Screenshots take at least 1/6 second on OS X. See https://crbug.com/741689 for discussion.
Implementation
Future<Uint8List> screenshot(
{ScreenshotFormat? format,
bool? fullPage,
Rectangle? clip,
int? quality,
bool? omitBackground,
bool? captureBeyondViewport,
bool? fromSurface}) async {
return base64Decode(await screenshotBase64(
format: format,
fullPage: fullPage,
clip: clip,
quality: quality,
omitBackground: omitBackground,
captureBeyondViewport: captureBeyondViewport,
fromSurface: fromSurface));
}