getFilesPath method

Future<List<String>?> getFilesPath({
  1. String fileType = "any",
})

Equivalent to DocumentsContract.buildDocumentUriUsingTree and here it decode URI's to full Path

Refer to details

Implementation

Future<List<String>?> getFilesPath({String fileType = "any"}) async {
  try {
    const kGetFilesPath = "buildChildDocumentsPathUsingTree";
    const kFileType = "fileType";
    const kSourceTreeUriString = "sourceTreeUriString";
    var sourceTreeUriString = _uriString;

    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;
  }
}