I am using the image_picker package and my code is as simple as :
**The ImagePicker and the image itself : **
GestureDetector(
onTap: () {
getImage();
},
child: Container(
child: pickedImagePath == null
? SvgPicture.asset(
'assets/images/profilePhotoAvatar.svg',
height: size.height * 0.15,
)
: Image.file(
File(pickedImagePath!.path),
height: size.height * 0.15,
),
),
),
The Getimage function :
XFile? pickedImagePath;
Future<void> getImage() async {
ImagePicker picker = ImagePicker();
XFile? pickedImage = await picker.pickImage(source: ImageSource.gallery);
setState(() {
pickedImagePath = pickedImage;
});
}
I am using a stateful widget, the plugin is properly set, I am able to pick and image from gallery and The pickedimage path does update if I try a print, It's just that the image won't update on this code
pickedImagePath == null
? SvgPicture.asset(
'assets/images/profilePhotoAvatar.svg',
height: size.height * 0.15,
)
: Image.file(
File(pickedImagePath!.path),
height: size.height * 0.15,
),
Thanks in advance for anybody who can help