saf
saf copied to clipboard
i don't get the logic?
i looked at your example, but its too complicated for me: i want to open Downloads to fetch a file i deposited there, i tryed:
....
if(defaultTargetPlatform == TargetPlatform.android)
{
print("target is android....");
Permission.storage.request();
print("requested stoargae access....");
Saf saf = Saf("/sdcard/Download");
print("asf started ....");
bool? isGranted = await saf.getDirectoryPermission(isDynamic: true); //what is the difference between dynamic and not?
print("asf asked permissions ....");
if (isGranted != null && isGranted) {
// Perform some file operations
print("asf asked directroeispath ....");
List<String>? directoriesPath = await Saf.getPersistedPermissionDirectories();
print("persistendirectories $directoriesPath");
List<String>? paths = await saf.getFilesPath();
print("paths $directoriesPath");
} else {
print("failed to get permission");
}
print("fdone for now");
}
```
but this opens a file browser whish is allready nice, but there i can't select the file in downloads.... so i let it create a directory at the root for it....
next try, i select the file, afterwards it asks me (again, why doesn't i reminds that i allready asked for it?) for the permission and then gets back with failed to get permission??
so i am confused, i need just the steps:
check if i can access the files, if not ask for permission
open the filebrowser,
be able to select a file,
get the filepath after selecting
how do i achieve this? and yes, android (for linux it is soooo much easier) is driving me nuts, how do i set the initial path to the correct directory? and how do i create the directory if it doesn't exist?
as far as i understood i won't only get an access to a memory copy of the file? how am i supposed to write the data back?
thanks in advance