URIs are instances of java.net.Uri class that represents the location of a document in the tree, can be a file/document or a directory itself
Lazily is a kind of optimization, in this case a heavy optimization, because the native Android method (listFiles cof-cof.) was so slow and so heavy that we lost 5~10 seconds of a frozen loading screen, and sometimes we suffered the OS task-kill, all because this method was loading ALL files/documents at once without any kind of optimization, this almost killed the phone if the directory had thousands of files, which is acceptable, some directories have a considerable collection of images, texts, videos, etc. But now is possible to load each file lazily through Stream Dart APIs, which means we can first load 5 files, then, if needed (through user scroll, user interation, etc), we can load more 5 items.
Be aware: The current usage can be considered hard to use, because the native API itself isn't friendly, but in a near future we can create separated packages that abstract a set of use-cases to make easier to implement inside Flutter apps
Breaking Changes
Almost everything.
The package started to support only few use-cases (pick a single directory and list granted URIs)
Now the current features are available (See glossary in the end of this doc for a better undestanding):
delete
listFiles
persistedUriPermissions
releasePersistableUriPermission
openDocumentTree
getDocumentContent
getDocumentContentAsString
renameTo
canRead
openDocumentTree
APIopenDocument
native methodhttps://github.com/lakscastro/shared-storage/blob/e295b0f800cdc30e6519263bd761fc9945f5f25e/android/src/main/kotlin/io/lakscastro/sharedstorage/saf/utils/DocumentCommon.kt#L182-L189
Glossary
java.net.Uri
class that represents the location of a document in the tree, can be a file/document or a directory itselflistFiles
cof-cof.) was so slow and so heavy that we lost 5~10 seconds of a frozen loading screen, and sometimes we suffered the OS task-kill, all because this method was loading ALL files/documents at once without any kind of optimization, this almost killed the phone if the directory had thousands of files, which is acceptable, some directories have a considerable collection of images, texts, videos, etc. But now is possible to load each file lazily throughStream
Dart APIs, which means we can first load 5 files, then, if needed (through user scroll, user interation, etc), we can load more 5 items.Be aware: The current usage can be considered hard to use, because the native API itself isn't friendly, but in a near future we can create separated packages that abstract a set of use-cases to make easier to implement inside Flutter apps