screenshots method

Future<ByteData?> screenshots({
  1. ImageByteFormat? format,
  2. double? pixelRatio,
})

screenshot format image format pixelRatio screenshot resolution ratio

Implementation

Future<ByteData?> screenshots(
    {ui.ImageByteFormat? format, double? pixelRatio}) async {
  final RenderRepaintBoundary boundary =
      currentContext!.findRenderObject() as RenderRepaintBoundary;
  final ui.Image image = await boundary.toImage(
      pixelRatio: pixelRatio ?? ui.window.devicePixelRatio);
  final ByteData? byteData =
      await image.toByteData(format: format ?? ui.ImageByteFormat.rawRgba);

  /// Uint8List uint8list = byteData.buffer.asUint8List();
  return byteData;
}