saf
library
Classes
DocumentBitmap
Represent the bitmap/image of a document.
DocumentFile
Equivalent to Android DocumentFile class
DocumentFileColumn
Representation of the available columns of DocumentsContract.Document.<Column>
UriPermission
Description of a single Uri permission grant.
This grants may have been created via Intent#FLAG_GRANT_READ_URI_PERMISSION,
etc when sending an Intent, or explicitly through Context#grantUriPermission(String, android.net.Uri, int).
Functions
canRead (Uri uri )
→ Future <bool ? >
Equivalent to DocumentFile.canRead.
canWrite (Uri uri )
→ Future <bool ? >
Equivalent to DocumentFile.canWrite.
child (Uri uri , String path , {bool requiresWriteAccess = false })
→ Future <DocumentFile ? >
Return the child of the given uri if it exists otherwise null.
copy (Uri uri , Uri destination )
→ Future <DocumentFile ? >
Copy a document uri to the destination.
createDirectory (Uri parentUri , String displayName )
→ Future <DocumentFile ? >
Create a direct child document tree named displayName given a parent parentUri.
createFile (Uri parentUri , {required String mimeType , required String displayName , Uint8List ? bytes , String content = '' })
→ Future <DocumentFile ? >
Convenient method to create files using either String or raw bytes Uint8List .
createFileAsBytes (Uri parentUri , {required String mimeType , required String displayName , required Uint8List bytes })
→ Future <DocumentFile ? >
Create a direct child document of parentUri.
createFileAsString (Uri parentUri , {required String mimeType , required String displayName , required String content })
→ Future <DocumentFile ? >
Convenient method to create a file.
using content as String instead Uint8List.
delete (Uri uri )
→ Future <bool ? >
Equivalent to DocumentFile.delete.
documentLength (Uri uri )
→ Future <int ? >
Equivalent to DocumentFile.length.
exists (Uri uri )
→ Future <bool ? >
Equivalent to DocumentFile.exists.
findFile (Uri directoryUri , String displayName )
→ Future <DocumentFile ? >
Equivalent to DocumentFile.findFile.
fromTreeUri (Uri uri )
→ Future <DocumentFile ? >
Create a new DocumentFile instance given uri.
getDocumentContent (Uri uri )
→ Future <Uint8List ? >
Get content of a given document uri.
getDocumentContentAsString (Uri uri , {bool throwIfError = false })
→ Future <String ? >
Helper method to generate the file path of the given uri
getDocumentThumbnail ({required Uri uri , required double width , required double height })
→ Future <DocumentBitmap ? >
Equivalent to DocumentsContract.getDocumentThumbnail.
getRealPathFromUri (Uri uri )
→ Future <String ? >
Helper method to generate the file path of the given uri
isPersistedUri (Uri uri )
→ Future <bool >
Convenient method to verify if a given uri.
is allowed to be write or read from SAF API's.
lastModified (Uri uri )
→ Future <DateTime ? >
Equivalent to DocumentFile.lastModified.
listFiles (Uri uri , {required List <DocumentFileColumn > columns })
→ Stream <DocumentFile >
Important : Ensure you have read permission by calling canRead before calling listFiles.
listFiles2 (Uri directoryUri )
→ Future <List <DocumentFile > ? >
mkdirp (Uri directoryUri , List <String > path )
→ Future <DocumentFile ? >
moveEx (Uri src , Uri srcDir , Uri destDir )
→ Future <DocumentFile ? >
openDocument ({Uri ? initialUri , bool grantWritePermission = true , bool persistablePermission = true , String mimeType = '*/*' , bool multiple = false })
→ Future <List <Uri > ? >
Refer to details .
openDocumentFile (Uri uri )
→ Future <bool ? >
It's a convenience method to launch the default application associated
with the given MIME type and can't be considered an official SAF API.
openDocumentTree ({bool grantWritePermission = true , bool persistablePermission = true , Uri ? initialUri })
→ Future <Uri ? >
Start Activity Action: Allow the user to pick a directory subtree.
parentFile (Uri uri )
→ Future <DocumentFile ? >
Get the parent file of the given uri.
persistedUriPermissions ()
→ Future <List <UriPermission > ? >
Returns an List<Uri> with all persisted Uri
releasePersistableUriPermission (Uri directory )
→ Future <void >
Will revoke an persistable Uri.
renameTo (Uri uri , String displayName )
→ Future <DocumentFile ? >
Rename the current document uri to a new displayName.
saveThumbnailFile ({required Uri uri , required double width , required double height , required String format , required String dest })
→ Future <bool >
shareUri (Uri uri , {String ? type })
→ Future <void >
Start share intent for the given uri.
shiftDocumentContent (Uri uri )
→ Future <String ? >
writeToFile (Uri uri , {Uint8List ? bytes , String ? content , FileMode ? mode })
→ Future <bool ? >
Convenient method to write to a file using either String or raw bytes Uint8List .
writeToFileAsBytes (Uri uri , {required Uint8List bytes , FileMode ? mode })
→ Future <bool ? >
Write to a file.
writeToFileAsString (Uri uri , {required String content , FileMode ? mode })
→ Future <bool ? >
Convenient method to write to a file.
using content as String instead Uint8List .