I'm using storage access framework to get media files from specific directory. I'm making the use of saf.cache() method which returns the list of string (basically media path)
but I need to sort this list of string by creation time/date. How can I do that?
Future<List<String>> fetchImages() async {
Saf saf = Saf('specific_directory');
List<String>? cacheList = await saf.cache();
List<String> imageList = cacheList!.where((element) => element.endsWith('.jpg')).toList(); // it returns In random order
return imageList;
}