Skip to content

Commit 0048584

Browse files
committed
store [nfc]: Stop using mutable Account variable in UpdateMachine.load
1 parent d316dda commit 0048584

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
@@ -958,8 +958,8 @@ class UpdateMachine {
958958
///
959959
/// In the future this might load an old snapshot from local storage first.
960960
static Future<UpdateMachine> load(GlobalStore globalStore, int accountId) async {
961-
Account account = globalStore.getAccount(accountId)!;
962-
final connection = globalStore.apiConnectionFromAccount(account);
961+
final connection = globalStore.apiConnectionFromAccount(
962+
globalStore.getAccount(accountId)!);
963963

964964
void stopAndThrowIfNoAccount() {
965965
final account = globalStore.getAccount(accountId);
@@ -971,11 +971,11 @@ class UpdateMachine {
971971
}
972972

973973
Future<void> updateZulipVersionData(ZulipVersionData data) async {
974-
account = globalStore.getAccount(accountId)!;
974+
final account = globalStore.getAccount(accountId)!;
975975
if (data.zulipVersion != account.zulipVersion
976976
|| data.zulipMergeBase != account.zulipMergeBase
977977
|| data.zulipFeatureLevel != account.zulipFeatureLevel) {
978-
account = await globalStore.updateAccount(accountId, AccountsCompanion(
978+
await globalStore.updateAccount(accountId, AccountsCompanion(
979979
zulipVersion: Value(data.zulipVersion),
980980
zulipMergeBase: Value(data.zulipMergeBase),
981981
zulipFeatureLevel: Value(data.zulipFeatureLevel)));

0 commit comments

Comments
 (0)