remove method

Future<bool> remove()

Removes this event if the status is sending, error or removed. This event will just be removed from the database and the timelines. Returns false if not removed.

Implementation

Future<bool> remove() async {
  final room = this.room;

  if (!status.isSent) {
    await room.client.database?.removeEvent(eventId, room.id);

    room.client.onEvent.add(EventUpdate(
      roomID: room.id,
      type: EventUpdateType.timeline,
      content: {
        'event_id': eventId,
        'status': EventStatus.removed.intValue,
        'content': {'body': 'Removed...'}
      },
    ));
    return true;
  }
  return false;
}