skip to Main Content

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

Firebase – How to run a function first before updating the array in react JS?

const handleItinerary = (e, type) => { var index = parseInt(e.target.name); let arr = [...itinerary]; if (type === "imageUrl") { const date = new Date().getTime(); const storageRef = ref(storage, `${date}`); uploadBytes(storageRef, e.target.files[0]).then((snapshot) => { getDownloadURL(storageRef).then((downloadURL) => { arr[index]["imageUrl"] = downloadURL;…

VIEW QUESTION
Back To Top
Search