init fixes

This commit is contained in:
Christien Rioux 2024-02-14 22:25:02 -05:00
parent 5cec423351
commit 031d7aea82
3 changed files with 21 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:veilid_support/veilid_support.dart';
import '../../init.dart';
import '../repository/account_repository/account_repository.dart';
class ActiveLocalAccountCubit extends Cubit<TypedKey?> {
@ -11,6 +12,12 @@ class ActiveLocalAccountCubit extends Cubit<TypedKey?> {
super(null) {
// Subscribe to streams
_initAccountRepositorySubscription();
// Initialize when we can
Future.delayed(Duration.zero, () async {
await eventualInitialized.future;
emit(_accountRepository.getActiveLocalAccount());
});
}
void _initAccountRepositorySubscription() {

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import '../../init.dart';
import '../models/models.dart';
import '../repository/account_repository/account_repository.dart';
@ -12,6 +13,12 @@ class LocalAccountsCubit extends Cubit<IList<LocalAccount>> {
super(IList<LocalAccount>()) {
// Subscribe to streams
_initAccountRepositorySubscription();
// Initialize when we can
Future.delayed(Duration.zero, () async {
await eventualInitialized.future;
emit(_accountRepository.getLocalAccounts());
});
}
void _initAccountRepositorySubscription() {

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import '../../init.dart';
import '../models/models.dart';
import '../repository/account_repository/account_repository.dart';
@ -12,6 +13,12 @@ class UserLoginsCubit extends Cubit<IList<UserLogin>> {
super(IList<UserLogin>()) {
// Subscribe to streams
_initAccountRepositorySubscription();
// Initialize when we can
Future.delayed(Duration.zero, () async {
await eventualInitialized.future;
emit(_accountRepository.getUserLogins());
});
}
void _initAccountRepositorySubscription() {