MessageMetaArrayKeyDeleteRequest constructor Null safety

MessageMetaArrayKeyDeleteRequest(
  1. {required BaseMessage message,
  2. required List<MessageMetaArray> metaArrays}
)

Implementation

MessageMetaArrayKeyDeleteRequest({
  required BaseMessage message,
  required List<MessageMetaArray> metaArrays,
}) : super() {
  if (message is UserMessage) {
    cmd = CommandString.userMessageUpdate;
  } else if (message is FileMessage) {
    cmd = CommandString.fileMessageUpdate;
  } else {
    throw InvalidParameterError();
  }

  payload.addAll({
    'channel_url': message.channelUrl,
    'msg_id': message.messageId,
    'metaarray': {
      'array': metaArrays.map((e) => e.toJson()).toList(),
      'mode': MetaArrayUpdateMode.remove.asString(),
      'upsert': false
    },
  });
}