I have a doubt, is there any way to make my application wait till the readings from firebase are complete?
for example:
Assuming that I want to get a value from firebase then I want to assign to variable, but when the application starts I don't want to see an empty screen, I could use a progress bar, but I didn't want a blank one.
Future<String>change()async{
await FirebaseFirestore.instance.collection('Users').where('mail',isEqual to 'test@gmail.com').get().then((value){
value.docs.forEach((result){
data1 = result.data()['rule'];
});
});
}
print (data);
if I print the data outside the method I will get null, How can I get a progress bar, so that the variable is only displayed after receiving the value from the database?