recallMessage method

Future<RecalledMessage> recallMessage({
  1. Message? message,
  2. String? messageID,
  3. int? messageTimestamp,
})

To recall a sent Message.

message is the sent Message. messageID is the Message.id of the sent Message. messageTimestamp is the Message.sentTimestamp of the sent Message.

You can provide either message or messageID with messageTimestamp to represent the sent Message; If provide message, then messageID with messageTimestamp will be ignored; If not provide both message and messageID with messageTimestamp, then will throw an error.

Returns the recalled Message which has Message.patchedTimestamp.

Implementation

Future<RecalledMessage> recallMessage({
  Message? message,
  String? messageID,
  int? messageTimestamp,
}) async {
  if (message == null) {
    if (messageID == null) {
      throw ArgumentError.notNull(
        'messageID',
      );
    }
    if (messageTimestamp == null) {
      throw ArgumentError.notNull(
        'messageTimestamp',
      );
    }
  }
  return await _patchMessage(
    oldMessage: message,
    oldMessageID: messageID,
    oldMessageTimestamp: messageTimestamp,
    recall: true,
  ) as RecalledMessage;
}