cache method

Future<List<String>?> cache({
  1. String? fileType,
})

Implementation

Future<List<String>?> cache({String? fileType}) async {
  try {
    const kCacheToExternalFilesDirectory = "cacheToExternalFilesDirectory";
    const kSourceTreeUriString = "sourceTreeUriString";
    const kFileType = "fileType";
    const kCacheDirectoryName = "cacheDirectoryName";

    var cacheDirectoryName = makeDirectoryPathToName(_directory);
    fileType ??= "any";

    final args = <String, dynamic>{
      kSourceTreeUriString: _uriString,
      kFileType: fileType,
      kCacheDirectoryName: cacheDirectoryName,
    };
    final paths = await kDocumentFileChannel.invokeMethod<List<dynamic>?>(
        kCacheToExternalFilesDirectory, args);
    if (paths == null) return null;
    return List<String>.from(paths);
  } catch (e) {
    return null;
  }
}