takeSingleScreenShot method
Implementation
Future<void> takeSingleScreenShot(RenderRepaintBoundary boundary) async {
try {
final image = await boundary.toImage(pixelRatio: 3.0);
final directory = (await getApplicationDocumentsDirectory()).path;
final byteData = await image.toByteData(format: ui.ImageByteFormat.png);
final pngBytes = byteData?.buffer.asUint8List();
var fileName = generateRandomText(6);
final imagePath = await File('$directory/$fileName.png').create();
// await ImageGallerySaver.saveImage(byteData!.buffer.asUint8List());
await imagePath.writeAsBytes(pngBytes!);
// await Share.shareXFiles([XFile(imagePath.path)]);
} catch (e) {
rethrow;
}
}