fetchCounts method

Future<void> fetchCounts()

Implementation

Future<void> fetchCounts() async {
  try {
    _objectBoxSubscription = ObjectboxRepository()
        .getTadamonLogsProductsCount()
        .listen((final count) {
          emit(state.copyWith(objectBoxCount: count));
        });

    _fireStoreSubscription = FireStoreRepository().getProductsCount().listen((
      final count,
    ) {
      emit(state.copyWith(firebaseCount: count));
    });
  } catch (e, s) {
    showErrorToast('Error fetching counts: $e\n$s');
  }
}