I already have a way if savinf the users image into a Uint8List, this is an example:
void importGalleryImage() async {
try {
Uint8List image = await pickImage(ImageSource.gallery);
setState(
() {
imgd = image;
},
);
} catch (e) {
setState(() {
debugPrint('No image selected.');
imgd = null;
});
}
}
Here is my pickImage function:
pickImage(ImageSource source) async {
final ImagePicker image = ImagePicker();
XFile? file = await image.pickImage(source: source);
if (file != null) {
return await file.readAsBytes();
} else {
debugPrint('No image selected');
}
}
I need to save imgd in FireStore, but I’m having problems figuring out how. Any ideas to help me out?
New contributor
Stefano Eugenio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.