takeScreenshot method
Take screen shot of the playground
Implementation
Future<LikkEntity?> takeScreenshot() async {
try {
final boundary = _playgroundKey.currentContext?.findRenderObject()
as RenderRepaintBoundary?;
if (boundary != null) {
final image = await boundary.toImage();
final byteData = await image.toByteData(format: ui.ImageByteFormat.png);
final data = byteData!.buffer.asUint8List();
final entity = await PhotoManager.editor.saveImage(data);
// await SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
return LikkEntity(entity: entity!, bytes: data);
}
} catch (e) {
log('Exception occured while capturing picture : $e');
}
}