generateWithKey method

Future<Uint8List> generateWithKey({
  1. required GlobalKey<State<StatefulWidget>> key,
  2. required SnapshotQuality quality,
})

Implementation

Future<Uint8List> generateWithKey({
  required GlobalKey key,
  required SnapshotQuality quality,
}) async {
  final boundary =
      key.currentContext!.findRenderObject() as RenderRepaintBoundary;
  final image = await boundary.toImage(pixelRatio: quality.pixelRatio);
  return _imageToUint8List(image);
}