getCachedFilesPathFor static method

Future<List<String>?> getCachedFilesPathFor(
  1. String? directory
)

Static method for Dynamic call Returns an List<String> with all cached files full path

To cach an Directory call cache and to clear a cached Directory call clearCache

Implementation

static Future<List<String>?> getCachedFilesPathFor(String? directory) async {
  if (directory == null) return null;
  try {
    const kGetFilesPath = "getCachedFilesPath";
    const kCacheDirectoryName = "cacheDirectoryName";

    var cacheDirectoryName = makeDirectoryPathToName(directory);

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