I use flutter to save a widget as an image in flutter. I have no problem with downloading the image but im having troubke with sharing the image. Is there a way i way share the downlaoded image without leaving the application?
Here's my present code
onPressed: () async {
if (await Permission.storage.request().isGranted) {
screenshotController.capture(pixelRatio: 1.5);
screenshotController.capture().then((File image) async {
await ImageGallerySaver.saveImage(image.readAsBytesSync());
Navigator.of(context, rootNavigator: true).pop();
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text("Image Saved to Gallery"),
duration: const Duration(seconds: 1),
),
);
}).catchError((onError) {
// print(onError);
});
} else {
await Permission.storage.request();
}
}
You need to handle the image as any other file.
If you do not intend to use a server between the two users, its a bit tricky because one of them must act as one, but if you will use a server, i suggest you to follow this post:
It's pretty recent and will help you with the app code and even with a server sample writen in nodejs. The next parts of the post teach you to do what you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.