leave method
Call the Matrix API to leave this room. If this room is set as a direct chat, this will be removed too.
Implementation
Future<void> leave() async {
try {
await client.leaveRoom(id);
} on MatrixException catch (e, s) {
if ([MatrixError.M_NOT_FOUND, MatrixError.M_UNKNOWN].contains(e.error)) {
Logs().w(
'Unable to leave room. Deleting manually from database...',
e,
s,
);
await _handleFakeSync(
SyncUpdate(
nextBatch: '',
rooms: RoomsUpdate(
leave: {
id: LeftRoomUpdate(),
},
),
),
);
}
rethrow;
}
return;
}