refactor to use mutations where helpful

This commit is contained in:
Henry Hiles 2026-11-02 17:06:01 -05:00
commit e9b009d1b9
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -8,7 +8,9 @@ import "package:nexus/controllers/unified_push.dart";
import "package:nexus/main.dart";
extension LogOut on MutationTarget {
Future<void> logOut(String accountId) async {
static final mutation = Mutation<void>();
Future<void> logOut(String accountId) => mutation.run(this, (_) async {
final accounts = await container.read(AccountsController.provider.future);
final account = accounts.firstWhereOrNull(
(account) => account.id == accountId,
@ -49,5 +51,5 @@ extension LogOut on MutationTarget {
await container
.read(ActiveAccountController.provider.notifier)
.switchTo(other.id);
}
});
}