ivehement / saf

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.
https://pub.dev/packages/saf
MIT License
17 stars 17 forks source link

How to sort list by date #18

Open superwebarmy opened 1 year ago

superwebarmy commented 1 year ago

Hi, I was wondering if we can sort the list of strings by their creation time or modified time. I'm making the use of cache method which returns list of string but it returns in the random order

AMuellerAtAHS commented 1 year ago

No, actually you can not sort the list of strings by time. Because the strings are only strings and have no information about creation time, modified time or anything else.

You are only able to sort the list with string comparison.

sortedPaths = paths.sort((a,b) => a.compareTo(b));