removeMessageMetaArray method

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

Removes values from list of metaArrays with given message

Implementation

Future<BaseMessage> removeMessageMetaArray(
  BaseMessage message,
  List<MessageMetaArray> metaArrays,
) async {
  if (message.channelUrl != channelUrl) {
    throw InvalidParameterError();
  }

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

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

  try {
    var result = await _sdk.cmdManager.sendCommand(cmd);
    if (result != null) {
      return BaseMessage.msgFromJson(result.payload, type: result.cmd)!;
    } else {
      throw WebSocketError();
    }
  } catch (e) {
    rethrow;
  }
}