downloadFileWithRetry method

Future<bool> downloadFileWithRetry(
  1. String pRemoteName,
  2. File pLocalFile, {
  3. int pRetryCount = 1,
  4. FileProgress? onProgress,
})

Download the Remote File pRemoteName to the local File pLocalFile pRetryCount number of attempts

this strategy can be used when we don't need to go step by step (connect -> download -> disconnect) or there is a need for a number of attempts in case of a poor connexion for example

Implementation

Future<bool> downloadFileWithRetry(
  String pRemoteName,
  File pLocalFile, {
  int pRetryCount = 1,
  FileProgress? onProgress,
}) {
  Future<bool> downloadFileRetry() async {
    bool res = await this.downloadFile(
      pRemoteName,
      pLocalFile,
      onProgress: onProgress,
    );
    return res;
  }

  return Utils.retryAction(() => downloadFileRetry(), pRetryCount);
}