Showing empty widget while FutureBuilder is loading data

Advertisements I have the following FutureBuilder: child: FutureBuilder( future: fetchNotifications(widget.usuarioId), builder: (context, snapshot) { if (snapshot.hasData) { List<dynamic>? filteredList = snapshot.data as List; return ListView.separated( separatorBuilder: (BuildContext context, int index) => new Divider( color: Colors.black26, thickness: 0.5, ), itemCount: filteredList.length, shrinkWrap: true, itemBuilder: (BuildContext context, index) { NotificationModelo notificacion = filteredList[index]; var textoNot = notificacion.texto;… Read More Showing empty widget while FutureBuilder is loading data

The return type 'ListView?' isn't a 'Widget', as required by the closure's context.dart

Advertisements I’m trying to make an async method that returns a ListView, so to add it to the body of my Scaffold I used future builder, but got this error. The return type ‘ListView?’ isn’t a ‘Widget’, as required by the closure’s context.dart This is my FuturuBuilder code: FutureBuilder<ListView>( future: getWidgets(context, this.residents), builder: ((context, snapshot)… Read More The return type 'ListView?' isn't a 'Widget', as required by the closure's context.dart

setState() not updating UI elements even though the state variable, a Future, is updated?

Advertisements I have a HomePage screen which has a FutureBuilder List implemented with a Future function as the state variable. I am updating this Future in another dart file by using keys to access the future. The Future gets updated and I’m sure of this as I’ve seen the print statements, but when I call… Read More setState() not updating UI elements even though the state variable, a Future, is updated?

From a `FutureBuilder`, my future never returns data

Advertisements In a future builder, I use the following future that should return the number of documents (The collection stores "seen" event of an ad detailed view): /// Stores and returns the document [id]. static Future<int> getCount({required String? adId}) { if (adId == null) return Future<int>.value(0); // = Actually store the document final c =… Read More From a `FutureBuilder`, my future never returns data

how can use future in the listview flutter?

Advertisements I have future function and I want show this in the listview.seprator, but the listview do not get the future value. how can i fix this? this is my code: my hive class: @HiveType(typeId: 3) class TaskCat extends HiveObject{ @HiveField(0) String catName; @HiveField(1) int userId; @HiveField(2) User? user; TaskCat(this.catName,this.user,this.userId); } This is my function:… Read More how can use future in the listview flutter?

how to return a form widget in futureBuild in flutter

Advertisements I have this code as am trying to code something to update data in firestore. @override Widget build(BuildContext context) { // Use the Todo to create the UI. return Scaffold( appBar: AppBar( title: Text(mid.toString()), ), body: FutureBuilder<Member?>( future: readMember(mid), builder: (context, snapshot) { if (snapshot.hasData) { final member = snapshot.data; /// return a form… Read More how to return a form widget in futureBuild in flutter