resendFileMessage method

FileMessage resendFileMessage(
  1. FileMessage message, {
  2. required FileMessageParams params,
  3. OnFileMessageCallback? onCompleted,
  4. OnUploadProgressCallback? progress,
})

Resends failed FileMessage on this channel with message.

It returns FileMessage with MessageSendingStatus.pending and onCompleted will be invoked once the message has been sent completely. Channel event ChannelEventHandler.onMessageReceived will be invoked on all other members' end. NOTE that the pending message does not have a messageId.

Implementation

FileMessage resendFileMessage(
  FileMessage message, {
  required FileMessageParams params,
  OnFileMessageCallback? onCompleted,
  OnUploadProgressCallback? progress,
}) {
  if (message.sendingStatus != MessageSendingStatus.failed) {
    throw InvalidParameterError();
  }
  if (message.channelUrl != channelUrl) {
    throw InvalidParameterError();
  }
  if (!message.isResendable()) {
    throw InvalidParameterError();
  }

  return sendFileMessage(
    params,
    progress: progress,
    onCompleted: onCompleted,
  );
}