syncWith static method

Future<bool?> syncWith(
  1. String? directory
)

Static method for Dynamic call Returns 'bool' on syncing the Directory's files with Cached Directory

Implementation

static Future<bool?> syncWith(String? directory) async {
  if (directory == null) return null;
  try {
    const kDynamicSyncWithExternalFilesDirectory =
        "dynamicSyncWithExternalFilesDirectory";
    const kSourceTreeUriString = "sourceTreeUriString";
    const kCacheDirectoryName = "cacheDirectoryName";

    var sourceUriString = makeUriString(path: directory, isTreeUri: true);
    var cacheDirectoryName = makeDirectoryPathToName(directory);

    final args = <String, dynamic>{
      kSourceTreeUriString: sourceUriString,
      kCacheDirectoryName: cacheDirectoryName,
    };
    final isSync = await kDocumentFileChannel.invokeMethod<bool?>(
        kDynamicSyncWithExternalFilesDirectory, args);
    if (isSync == null) return null;
    return isSync;
  } catch (e) {
    return null;
  }
}