|
|
@ -130,7 +130,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState |
|
|
|
BehaviorSubject<List<Account>> accounts = BehaviorSubject<List<Account>>.seeded([]); |
|
|
|
BehaviorSubject<List<Account>> accounts = BehaviorSubject<List<Account>>.seeded([]); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
BehaviorSubject<Account?> activeAccount = BehaviorSubject<Account?>.seeded(null) |
|
|
|
BehaviorSubject<Account?> activeAccount = BehaviorSubject<Account?>() |
|
|
|
..distinct((final current, final next) => current?.id != next?.id); |
|
|
|
..distinct((final current, final next) => current?.id != next?.id); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -191,10 +191,10 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState |
|
|
|
|
|
|
|
|
|
|
|
/// The currently active account. |
|
|
|
/// The currently active account. |
|
|
|
/// |
|
|
|
/// |
|
|
|
/// Equivalent to activeAccount.value but throws a [StateError] when no user is logged in. |
|
|
|
/// Equivalent to activeAccount.valueOrNull but throws a [StateError] when no user is logged in. |
|
|
|
@visibleForTesting |
|
|
|
@visibleForTesting |
|
|
|
Account get aa { |
|
|
|
Account get aa { |
|
|
|
final aa = activeAccount.value; |
|
|
|
final aa = activeAccount.valueOrNull; |
|
|
|
|
|
|
|
|
|
|
|
if (aa == null) { |
|
|
|
if (aa == null) { |
|
|
|
throw StateError('No user is logged in.'); |
|
|
|
throw StateError('No user is logged in.'); |
|
|
@ -204,7 +204,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Whether accounts are logged in. |
|
|
|
/// Whether accounts are logged in. |
|
|
|
bool get hasAccounts => activeAccount.value != null; |
|
|
|
bool get hasAccounts => activeAccount.valueOrNull != null; |
|
|
|
|
|
|
|
|
|
|
|
/// The options for the [activeAccount]. |
|
|
|
/// The options for the [activeAccount]. |
|
|
|
/// |
|
|
|
/// |
|
|
|