repaintBoundaryToImageBytes static method

Future<Uint8List?> repaintBoundaryToImageBytes(
  1. RenderRepaintBoundary? boundary, {
  2. double pixelRatio = 3.0,
  3. ImageByteFormat format = ui.ImageByteFormat.png,
})

Implementation

static Future<Uint8List?> repaintBoundaryToImageBytes(
  RenderRepaintBoundary? boundary, {
  double pixelRatio = 3.0,
  ui.ImageByteFormat format = ui.ImageByteFormat.png,
}) async {
  final ui.Image? image = await boundary?.toImage(pixelRatio: pixelRatio);
  final ByteData? byteData = await image?.toByteData(format: format);
  return byteData?.buffer.asUint8List();
}