DEV Community

zalek
zalek

Posted on

Problem with flutter and Firestore – a newbie question.

I created a program which reads Firestore in a Stateless widget – and it worked. I decided to convert the program to a statefull widget – and it is not working.
After displaying some info I come to conclusion the program tried execute some calculation before the Firestore data was available.
:
I have a function:

Future getDocs() async {
await FirebaseFirestore.instance
.collection('Spanish').get().then((snapshot) {
print("********getDocs() 1");
......
So my question is: how to postpone the execution of a program until the data will be available?
I tried to remove asyc/await – but it didn’t help.
Any ideas?

Thanks!

Top comments (0)