uploadFileWithRetry method

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

Upload the File fileToUpload to the current directory if pRemoteName is not setted the remote file will take take the same local name pRetryCount number of attempts

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

Implementation

Future<bool> uploadFileWithRetry(
  File fileToUpload, {
  String pRemoteName = '',
  int pRetryCount = 1,
  FileProgress? onProgress,
}) {
  Future<bool> uploadFileRetry() async {
    bool res = await this.uploadFile(
      fileToUpload,
      sRemoteName: pRemoteName,
      onProgress: onProgress,
    );
    return res;
  }

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