How to pass image picked from file from one activity to other in flutter...
I am using this code to picked image from gallery.
File? image;
Future pickImage() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
setState(() => this.image = imageTemp);
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
I want to pass the variable named image to other class. on button click