flutterfilepathgalleryphoto

In Flutter get a list of files(paths) from Photo/Gallery Directory for Android/iOS


I'm using flutter and as part of an app, am trying to build a page that will be filled with descriptive widgets generated using video files located on the device's gallery/photo libraries.

I need help finding a way to access this path, though.

With path_provider, I have no issue accessing other paths, such as application directories etc.. but not this one,

on the other hand. I can see packages like gallery_saver or Image_Picker, which are able to write directly to the folder itself or use access to the files inside their UI.

This seems like a standard use to me, so I'm not sure why I'm missing it. I need a way to access either just the path for the folder or short of that, a utility that will return the paths of the files in the directory as a list so I can work with them.

any help would be appreciated. Thanks


Solution

  • You can get list of path of whole device photos/videos by using photo_manager.

    For example

    final List<AssetPathEntity> paths = await PhotoManager.getAssetPathList();
    
    paths.forEach((e){
     // Here you can get Path of files
    });