DEV Community

zalek
zalek

Posted on

1

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay