getFilesPathFor static method
Static method for Dynamic call
Equivalent to DocumentsContract.buildDocumentUriUsingTree
and
here it decode URI's to full Path
Implementation
static Future<List<String>?> getFilesPathFor(String? directory,
{String fileType = "any"}) async {
if (directory == null) return null;
try {
const kGetFilesPath = "buildChildDocumentsPathUsingTree";
const kFileType = "fileType";
const kSourceTreeUriString = "sourceTreeUriString";
var sourceTreeUriString = makeUriString(path: directory, isTreeUri: true);
final args = <String, dynamic>{
kFileType: fileType,
kSourceTreeUriString: sourceTreeUriString,
};
final paths = await kDocumentsContractChannel
.invokeMethod<List<dynamic>?>(kGetFilesPath, args);
if (paths == null) return null;
return List<String>.from(paths);
} catch (e) {
return null;
}
}