I have this code in my build:
XFile? file;
...
body: Container(
color: Colors.black,
child: SizedBox(
height: MediaQuery.of(context).size.width,
width: MediaQuery.of(context).size.width,
child: AspectRatio(
aspectRatio: 1,
child: GestureDetector(
onTap: () => editPhoto(),
child: Image.file(File(file!.path))), //here is the line with problems
),
),
)
With my editPhoto() method, I modify the file whose path is read in my Image.file, but in my screen I still see the old image before the edit. Now, I know for sure that the file has effectively changed because in another part of my code I can see the changes, so the problem is that Image.file doesn't update. How can I solve?