-1
I have a function that accesses the Firestore and returns a list, when I click on a button this function is called and should create a lisrviwerbuilder()
. But I don’t know why he doesn’t create.
readdados() async {
QuerySnapshot snapshot = await Firestore.instance.collection('cliente').getDocuments();
snapshot.documents.forEach((d) {listanomes.add(d.data['nome']);
});
return listanomes;
}
RaisedButton(onPressed: () {
readdados();
}),
],
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.only(top: 10),
itemCount: listanomes.length,
itemBuilder: (context, index) {
return ListTile(title: Text(listanomes[index]));
})),