updateMessage method
To update content of a sent Message
.
oldMessage
is the sent Message
.
oldMessageID
is the Message.id of the sent Message
.
oldMessageTimestamp
is the Message.sentTimestamp of the sent Message
.
newMessage
is the Message
with new content.
You can provide either oldMessage
or oldMessageID
with oldMessageTimestamp
to represent the sent Message
;
If provide oldMessage
, then oldMessageID
with oldMessageTimestamp
will be ignored;
If not provide both oldMessage
and oldMessageID
with oldMessageTimestamp
, then will throw an error.
Returns the updated Message
which has Message.patchedTimestamp.
Implementation
Future<Message> updateMessage({
Message? oldMessage,
String? oldMessageID,
int? oldMessageTimestamp,
required Message newMessage,
}) async {
if (oldMessage == null) {
if (oldMessageID == null) {
throw ArgumentError.notNull(
'oldMessageID',
);
}
if (oldMessageTimestamp == null) {
throw ArgumentError.notNull(
'oldMessageTimestamp',
);
}
}
return await _patchMessage(
oldMessage: oldMessage,
oldMessageID: oldMessageID,
oldMessageTimestamp: oldMessageTimestamp,
newMessage: newMessage,
);
}