deleteAccount method
- UserId id
Deletes the account with the provided UserId from the list.
Also performs logout, when deleting the current account.
Implementation
Future<void> deleteAccount(UserId id) async {
accounts.removeWhere((e) => e.value.id == id);
if (id == _authService.userId) {
_authService.logout();
router.auth();
router.tab = HomeTab.chats;
} else {
await _authService.removeAccount(id);
}
}