Issue I dont know what is happening in this portion of code: Future fnct() { print("inside fnct()"); return Future.delayed(Duration(seconds:4),()=>"hello"); } Future fnct2() async { fnct().then((x){ print("inside then()"); }); here, this code works perfectly fine even without use of await keyword
Continue readingTag: future
Forcing a QiChatbot to reply to a phrase typed by the user
Issue I am working on a Pepper application on android that uses a QiChatbot to communicate with users about minerals. I want to make the chatbot also available for on-screen use for people with hearing and/or speech impairment. So i
Continue readingHow to use nested FutureBuilders and make sure one future is called after another?
Issue To avoid my FutureBuilder being called again and again (see this), I have the habbit of calling my futures in initState and it has always worked fine until I had to use nested ones. Basically I want the second
Continue readingWhy future sequence runs this way?
Issue Following code: void main() async { print("A"); await Future(() async { // Main future print("B"); Future(()=>print("C")); Future.microtask(()=>print("D")); await Future(()=>print("E")); print("F"); }); print("G"); } shows this sequence: A B D C E F G I’m expecting this sequence: A B
Continue readingHow I can get value from class extends ChangeNotifier
Issue How I can get value from class extends ChangeNotifier when I use User user = Provider.of<UserController>(context, listen: false).user; => user null? class UserController extends ChangeNotifier { User _user; User get user => _user; Future<void> getUser() async { String token
Continue readingFlutter Bloc await for response before continueing
Issue 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?
Continue readingFlutter, how to return different widget based on future value?
Issue I would like to base on a future bool value, to set different icons pass back to a data card inside a list, I tried .then or FutureBuilder, but still not successful. Scaffold: child: ListView.builder( itemCount: fullList.length, itemBuilder: (BuildContext
Continue readingWhat exactly await does internally in Dart?
Issue I’m working on a flutter application which requires using local storage. As the document directory path in Android will be given in Future<Directory>, I have to check whether the future finishes or not, each time I want to use
Continue readingTrying to handle exception in a Future<String?> with no success in a `FutureBuilder` context
Issue I have to fetch ta video URL store in FireStore before displaying the video itself. I used a FutureBuilderin my build to do so: if (ad.videoUrl != null) FutureBuilder( future: Video.videoUrl("blabla"), //ad.videoUrl!), builder: (context, snapshot) { if (snapshot.hasData) {
Continue readinghow to create dynamic list of futures for futurebuilder
Issue I have a longList where I need each element in the list to be sent to a database to return some a sub-list. I then display each value in it’s own PageView using PageView.builder. and FutureBuilder. At first I
Continue reading