Skip to content

Commit

Permalink
Wait for AccountBloc to be hydrated before navigating to initial route
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Jul 2, 2024
1 parent 2f7ad20 commit 6ea6fa5
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 167 deletions.
5 changes: 5 additions & 0 deletions lib/bloc/account/account_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class AccountState {
final PaymentFilters paymentFilters;
final ConnectionStatus? connectionStatus;
final VerificationStatus? verificationStatus;
final bool hydrated;

const AccountState({
required this.id,
Expand All @@ -44,6 +45,7 @@ class AccountState {
required this.paymentFilters,
required this.connectionStatus,
this.verificationStatus = VerificationStatus.UNVERIFIED,
required this.hydrated,
});

AccountState.initial()
Expand All @@ -64,6 +66,7 @@ class AccountState {
paymentFilters: PaymentFilters.initial(),
connectionStatus: null,
verificationStatus: VerificationStatus.UNVERIFIED,
hydrated: false,
);

AccountState copyWith({
Expand Down Expand Up @@ -101,6 +104,7 @@ class AccountState {
paymentFilters: paymentFilters ?? this.paymentFilters,
connectionStatus: connectionStatus ?? this.connectionStatus,
verificationStatus: verificationStatus ?? this.verificationStatus,
hydrated: hydrated,
);
}

Expand Down Expand Up @@ -151,6 +155,7 @@ class AccountState {
verificationStatus: json["verificationStatus"] != null
? VerificationStatus.values[json["verificationStatus"]]
: VerificationStatus.UNVERIFIED,
hydrated: true,
);
}

Expand Down
Loading

0 comments on commit 6ea6fa5

Please sign in to comment.