Help me please, I have saved in sqlite image Uint8List as TEXT in database, now i want to display it and i dont know how to fetch with future builder. I have DBHElper with function, but dont know how to get that image and show it with FutureBuilder. Flutter
getFromGallery(ImageSource source) async {
final ImagePicker imagePicker = ImagePicker();
XFile? file = await imagePicker.pickImage(source: source);
if (file != null) {
return await file.readAsBytes();
}
}
void selectImage() async {
Uint8List imageFile = await getFromGallery(ImageSource.gallery);
setState(() {
_image = imageFile;
});
}
This is the function that saves the image to sqlite
2
Answers
save as TEXT like
and convert back to
In this example, DBHelper is assumed to have a method called getImage that takes an imageId parameter and returns a Future that retrieves the image data from the database. The ImageDisplayWidget takes an imageId parameter and uses FutureBuilder to asynchronously retrieve and display the image data.