Saving Flutter image from gallery with ImagePicker

Nevermind, I managed to make it persistent with SharedPreferences, I simply made two different functions, each to save or load the image, and added _loadImage() to initState

void _saveImage(path) async {
SharedPreferences saveImage = await SharedPreferences.getInstance();
saveImage.setString('imagepath', path);
print('Image Saved!');



  void _loadImage() async {
SharedPreferences saveImage = await SharedPreferences.getInstance();
setState(() {
  _imagepath = saveImage.getString('imagepath');
});

}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top