In my app, I call images from firebase and create a share image button, but when I click on it, it shares the image link, not the image.
this is my code
class PhotoShow extends StatefulWidget {
const PhotoShow({Key? key}) : super(key: key);
@override
State<PhotoShow> createState() => _PhotoShowState();
}
class _PhotoShowState extends State<PhotoShow> {
List<String> _imageURLs = [];
int _currentIndex = 0;
@override
void initState() {
getPhoto();
super.initState();
}
getPhoto() async {
final FirebaseStorage storage = FirebaseStorage.instance;
ListResult result = await storage.ref().child('photos').listAll();
for (Reference ref in result.items) {
final String downloadUrl = await ref.getDownloadURL();
setState(() {
_imageURLs.add(downloadUrl);
});
}
}
This is the share image button:
IconButton(
icon: Icon(
Icons.share,
color: Colors.white,
size: 32,
),
onPressed: () async {
Share.shareFiles(_imageURLs);
},
),