cancelSend method
Removes an unsent or yet-to-send event from the database and timeline.
These are events marked with the status SENDING
or ERROR
.
Throws an exception if used for an already sent event!
Implementation
Future<void> cancelSend() async {
if (status.isSent) {
throw Exception('Can only delete events which are not sent yet!');
}
await room.client.database?.removeEvent(eventId, room.id);
room.client.onCancelSendEvent.add(eventId);
}