Janos Kiss
 · Custom Templates 👉 shop.completapp.com

(CUSTOM ACTION) Share Images from Firebase Firestore

I tested this on iPhone and worked. During a test on android studio emulator nothing happened, so not sure it is working on Android, but it should on real device.  

 Action Name:shareFirebaseImage
No returnArguments:firebaseImage - and it is an ImagePath
Parameters:share_plus: ^4.0.3
path_provider: ^2.0.9
http: ^0.13.4
Packages:import 'package:share_plus/share_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart' as http;
import 'dart:io';
Full Code:import 'package:share_plus/share_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart' as http;
import 'dart:io';

Future shareFirebaseImage(String firebaseImage) async {
  final imageurl = firebaseImage;
  final uri = Uri.parse(imageurl);
  final response = await http.get(uri);
  final bytes = response.bodyBytes;
  final temp = await getTemporaryDirectory();
  final path = '${temp.path}/image.jpg';

  File(path).writeAsBytesSync(bytes);

  await Share.shareFiles([path], text: 'Image Shared');
}
[CleanShot 2022-04-08 at [email protected]]  
2
12 replies