skip to Main Content

Future not returning String – Flutter

Why do I keep getting 'Instance of...' when I'm trying to get a String. What's wrong with the function? Future<string?> counter() async { Future.delayed(const Duration(seconds: 5), () { context.watch<FoodCount>().display(widget.food).toString(); return widget.food.quantity.toString(); }); int count = widget.food.quantity; // print(count); return count;…

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