leaveChat method

Future<void> leaveChat(
  1. ChatId id
)

Leaves the Chat identified by the provided id.

Implementation

Future<void> leaveChat(ChatId id) async {
  try {
    await _chatService.removeChatMember(id, me!);
    if (router.route == '${Routes.chats}/$id') {
      router.pop();
    }
  } on RemoveChatMemberException catch (e) {
    MessagePopup.error(e);
  } catch (e) {
    MessagePopup.error(e);
    rethrow;
  }
}