captureSnapshot method

Future<CaptureSnapshotResult> captureSnapshot(
  1. List<String> computedStyles, {
  2. bool? includePaintOrder,
  3. bool? includeDOMRects,
  4. bool? includeBlendedBackgroundColors,
  5. bool? includeTextColorOpacities,
})

Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened. computedStyles Whitelist of computed styles to return. includePaintOrder Whether to include layout object paint orders into the snapshot. includeDOMRects Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot includeBlendedBackgroundColors Whether to include blended background colors in the snapshot (default: false). Blended background color is achieved by blending background colors of all elements that overlap with the current element. includeTextColorOpacities Whether to include text color opacity in the snapshot (default: false). An element might have the opacity property set that affects the text color of the element. The final text color opacity is computed based on the opacity of all overlapping elements.

Implementation

Future<CaptureSnapshotResult> captureSnapshot(List<String> computedStyles,
    {bool? includePaintOrder,
    bool? includeDOMRects,
    bool? includeBlendedBackgroundColors,
    bool? includeTextColorOpacities}) async {
  var result = await _client.send('DOMSnapshot.captureSnapshot', {
    'computedStyles': [...computedStyles],
    if (includePaintOrder != null) 'includePaintOrder': includePaintOrder,
    if (includeDOMRects != null) 'includeDOMRects': includeDOMRects,
    if (includeBlendedBackgroundColors != null)
      'includeBlendedBackgroundColors': includeBlendedBackgroundColors,
    if (includeTextColorOpacities != null)
      'includeTextColorOpacities': includeTextColorOpacities,
  });
  return CaptureSnapshotResult.fromJson(result);
}