Skip to content

Commit 413bf1b

Browse files
committed
store [nfc]: Stop using mutable Account variable in UpdateMachine.load
1 parent 2983cdb commit 413bf1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/model/store.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,8 @@ class UpdateMachine {
983983
///
984984
/// In the future this might load an old snapshot from local storage first.
985985
static Future<UpdateMachine> load(GlobalStore globalStore, int accountId) async {
986-
Account account = globalStore.getAccount(accountId)!;
987-
final connection = globalStore.apiConnectionFromAccount(account);
986+
final connection = globalStore.apiConnectionFromAccount(
987+
globalStore.getAccount(accountId)!);
988988

989989
void stopAndThrowIfNoAccount() {
990990
final account = globalStore.getAccount(accountId);
@@ -996,11 +996,11 @@ class UpdateMachine {
996996
}
997997

998998
Future<void> updateZulipVersionData(ZulipVersionData data) async {
999-
account = globalStore.getAccount(accountId)!;
999+
final account = globalStore.getAccount(accountId)!;
10001000
if (data.zulipVersion != account.zulipVersion
10011001
|| data.zulipMergeBase != account.zulipMergeBase
10021002
|| data.zulipFeatureLevel != account.zulipFeatureLevel) {
1003-
account = await globalStore.updateAccount(accountId, AccountsCompanion(
1003+
await globalStore.updateAccount(accountId, AccountsCompanion(
10041004
zulipVersion: Value(data.zulipVersion),
10051005
zulipMergeBase: Value(data.zulipMergeBase),
10061006
zulipFeatureLevel: Value(data.zulipFeatureLevel)));

0 commit comments

Comments
 (0)