提问者:小点点

如何共享从flutter下载的图像


我使用flutter将小部件保存为flutter中的图像。我没有问题下载的图像,但我有问题与分享的图像。有没有一种方式我可以分享降级的图像而不离开应用程序?

这是我现在的代码

     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();
                                  }
                                },

共1个答案

匿名用户

除非你在自己的应用程序中分享给使用它的人(比如whatsapp),否则不打开flutter应用程序就无法将文件分享给其他应用程序。