This code works but nothing happens if I add a new marker in the "POSITIONS" collection of Firebase
void initState() {
super.initState();
getFirebaseMarkers();
....
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children:[
GoogleMap(
markers: Set<Marker>.of(_markers),
.....
void getFirebaseMarkers() {
firestore.collection('POSITIONS').get().then(
(QuerySnapshot querySnapshot) => {
for (var doc in querySnapshot.docs){
_addMarker(doc), // add a new marker into _markers
},
},
);
}
I know I need to use 'streamBuilder'. I haven't been able to get the few examples I found on the internet to work.
Can someone help me please?