in this code I am able to retrieve data from Firestore once after I starts to run this page. Is it possible to make it run in real time where it will be able to get all the data from Firestore in real time?
Future getMarker() async{
Firestore.instance.collection('markers').getDocuments().then((myData){
if(myData.documents.isNotEmpty){
for (int i = 0; i < myData.documents.length; i++){
initMarker(myData.documents[i].data, myData.documents[i].documentID);
}
}
});
}
When i change the getDocuments()
to snapshots()
then method then()
will give out an error stated that then()
is not a Stream type. Or is there any approach to this. Thank you in advance.