cancelFileMessageUpload method

bool cancelFileMessageUpload(
  1. String requestId
)

Cancels an ongoing FileMessage upload.

Implementation

bool cancelFileMessageUpload(String requestId) {
  sbLog.i(StackTrace.current, 'requestId: $requestId');
  checkUnsupportedAction();

  if (requestId.isEmpty) {
    throw InvalidParameterException();
  }

  final task = chat.getUploadTask(requestId);
  if (task == null) {
    return false;
  }

  final queue = chat.getMessageQueue(channelUrl);
  chat.apiClient.cancelUploadingFile(requestId);
  return queue.cancel(task.hashCode);
}