Skip to content

Commit 228c9bd

Browse files
committed
store [nfc]: Add account-exists assert in _reloadPerAccount
I believe this is effectively already done by the existing assert `_perAccountStores.containsKey`, because of the invariant that _accounts contains all the keys in _perAccountStores. But the explicitness seems helpful. (And loadPerAccount relies on the account existing.)
1 parent 580474b commit 228c9bd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/model/store.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ abstract class GlobalStore extends ChangeNotifier {
154154
}
155155

156156
Future<void> _reloadPerAccount(int accountId) async {
157+
assert(_accounts.containsKey(accountId));
157158
assert(_perAccountStores.containsKey(accountId));
158159
assert(!_perAccountStoresLoading.containsKey(accountId));
159160
final store = await loadPerAccount(accountId);

0 commit comments

Comments
 (0)