skip to Main Content

Flutter BloC couldn't find correct provider when context.read is called

I created a basic project to learn Flutter better. In bnb.dart file if I use: context.read<AppBottomNavigationBarState>().selectedIndex to change the currentIndex field of the BottomNavigationBar. The application throws: The following ProviderNotFoundException was thrown building BlocBuilder<AppBottomNavigationBarCubit, AppBottomNavigationBarState> But if I change that…

VIEW QUESTION

Flutter Bloc await for response before continueing

I have following code: class BidBloc extends Bloc<BidEvent, BidState> { final FirestoreRepository firestoreRepository; BidBloc({required this.firestoreRepository}) : super(BidsLoadingState()) { on<LoadAllBidsEvent>((event, emit) async { emit(BidsLoadingState()); Item item = event.item; Future getBids() async { List<Bid> bids = []; item.bids?.forEach((element) async { Bid? bid…

VIEW QUESTION
Back To Top
Search