Skip to content

Commit e900b8d

Browse files
committed
store [nfc]: Move assert up to core that connection/account agree on realmUrl
1 parent 766ff81 commit e900b8d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/model/store.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ class CorePerAccountStore {
339339
required GlobalStore globalStore,
340340
required this.connection,
341341
required this.accountId,
342-
}) : _globalStore = globalStore;
342+
}) : _globalStore = globalStore,
343+
assert(connection.realmUrl == globalStore.getAccount(accountId)!.realmUrl);
343344

344345
final GlobalStore _globalStore;
345346
final ApiConnection connection; // TODO(#135): update zulipFeatureLevel with events
@@ -422,7 +423,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
422423
);
423424
final channels = ChannelStoreImpl(initialSnapshot: initialSnapshot);
424425
return PerAccountStore._(
425-
globalStore: globalStore,
426426
core: core,
427427
queueId: queueId,
428428
realmUrl: realmUrl,
@@ -465,7 +465,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
465465
}
466466

467467
PerAccountStore._({
468-
required GlobalStore globalStore,
469468
required super.core,
470469
required this.queueId,
471470
required this.realmUrl,
@@ -487,8 +486,7 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
487486
required this.unreads,
488487
required this.recentDmConversationsView,
489488
required this.recentSenders,
490-
}) : assert(realmUrl == globalStore.getAccount(core.accountId)!.realmUrl),
491-
assert(realmUrl == core.connection.realmUrl),
489+
}) : assert(realmUrl == core.connection.realmUrl),
492490
assert(emoji.realmUrl == realmUrl),
493491
_realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
494492
_emoji = emoji,

0 commit comments

Comments
 (0)