calculateMarkers property
The ReactiveGoogleMap component uses the ElasticSearch hits to render the markers, if you wish to override the default markers then ``calculateMarkers` prop is the way.
The below example uses the aggregations
data to calculate the markers.
calculateMarkers: (SearchController controller) {
List<Place> places = [];
for (var bucket in controller.aggregationData?.data ?? []) {
try {
// To get coordinates from GeoHash
var locationDecode = GeoHash(bucket["_key"]);
places.add(Place(
name: bucket["_key"],
id: bucket["_key"],
position: LatLng(locationDecode.latitude(),
locationDecode.longitude())));
} catch (e) {
print(e);
}
}
return places;
}
Implementation
final List<Place> Function(SearchController searchController)?
calculateMarkers;