updateFileMessage method

Future<FileMessage> updateFileMessage(
  1. int messageId,
  2. FileMessageParams params
)

Updates FileMessage on this channel with messageId and params.

Implementation

Future<FileMessage> updateFileMessage(
    int messageId, FileMessageParams params) async {
  if (messageId <= 0) {
    throw InvalidParameterError();
  }

  final cmd = Command.buildUpdateFileMessage(
    channelUrl,
    messageId,
    params,
  );

  try {
    final res = await _sdk.cmdManager.sendCommand(cmd);
    if (res != null) {
      return BaseMessage.msgFromJson<FileMessage>(
        res.payload,
        type: cmd.cmd,
      )!; //mark!
    } else {
      logger.e('failed to update file message');
      throw WebSocketError();
    }
  } catch (e) {
    rethrow;
  }
}