downloadFileFromICloud method

Future<String?> downloadFileFromICloud(
  1. String relativePath,
  2. String newPath,
  3. String containerId
)

Downloads a file from iCloud

Implementation

Future<String?> downloadFileFromICloud(
    String relativePath, String newPath, String containerId) async {
  try {
    await IcloudStorageSync().download(
        containerId: containerId,
        relativePath: Uri.decodeFull(relativePath).replaceAll('%20', ' '),
        destinationFilePath: Uri.decodeFull(newPath).replaceAll('%20', ' '),
        onProgress: (progress) async {});
    return Uri.decodeFull(newPath).replaceAll('%20', ' ');
  } catch (e) {
    debugPrint('Error while downloading file from iCloud: ${e.toString()}');
    return null;
  }
}