removeMessageMetaArrayValues method

Future<BaseMessage> removeMessageMetaArrayValues(
  1. BaseMessage message,
  2. List<MessageMetaArray> metaArrays
)

Removes message meta array values.

Implementation

Future<BaseMessage> removeMessageMetaArrayValues(
  BaseMessage message,
  List<MessageMetaArray> metaArrays,
) async {
  sbLog.i(StackTrace.current, 'metaArrays: $metaArrays');
  checkUnsupportedAction();

  if (message.channelUrl != channelUrl) {
    throw InvalidParameterException();
  }

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

  final cmd = Command.buildUpdateMessageMetaArray(
      message, metaArrays, MetaArrayUpdateMode.remove, true);

  var result = await chat.commandManager.sendCommand(cmd);
  if (result != null) {
    return BaseMessage.getMessageFromJsonWithChat(chat, result.payload,
        commandType: result.cmd);
  } else {
    throw WebSocketFailedException();
  }
}