Skip to content

Instantly share code, notes, and snippets.

@Frankdroid7
Last active December 15, 2021 12:43
Show Gist options
  • Save Frankdroid7/b960594505e1e2888ffb6644e361b22d to your computer and use it in GitHub Desktop.
Save Frankdroid7/b960594505e1e2888ffb6644e361b22d to your computer and use it in GitHub Desktop.
_shareQrCode() async {
final directory = (await getApplicationDocumentsDirectory()).path;
screenshotController.capture().then((Uint8List image) async {
if (image != null) {
try {
String fileName = DateTime.now().microsecondsSinceEpoch.toString();
final imagePath = await File('$directory/$fileName.png').create();
if (imagePath != null) {
await imagePath.writeAsBytes(image);
Share.shareFiles([imagePath.path]);
}
} catch (error) {}
}
}).catchError((onError) {
print('Error --->> $onError');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment