aloisdeniel / media_gallery

A Flutter plugin that lists native gallery items.
MIT License
87 stars 33 forks source link

MediaGallery.listMediaCollections() still getting recently deleted files #4

Closed jj-gh closed 4 years ago

jj-gh commented 4 years ago

My experience in native android development is pretty much close to nil so I'm not sure if this is a bug in the package or an android "feature" that needs further handling, but after deleting files in my app, and I call the MediaGallery.listMediaCollections() again at some point to refresh the list, the deleted files would still be in the list with the same item count even when the album is already empty. Even reinstalling my app doesn't fix it. Only by accessing the directory on my PC via USB and then reopening the app would strangely fix it. Judging by the behavior, I'm guessing it's an android thing that I'm not aware of. Shedding some light to this issue would be greatly appreciated.

aloisdeniel commented 4 years ago

Thanks for reporting this!

It seems that their is a flag for deleted files : IS_TRASHED. It should do the trick. I'll add it to the query for removing them from the result!.