bpillon / google_maps_cluster_manager

Simple Flutter clustering library for Google Maps
https://pub.dev/packages/google_maps_cluster_manager
MIT License
121 stars 94 forks source link

Syntax question about markerBuilder #25

Closed maxouille closed 3 years ago

maxouille commented 3 years ago

Hi,

First of all, awesome plugin, thank you !

I managed to make it work but I don't understand the following syntax : static Future<Marker> Function(Cluster) get markerBuilder => (cluster) async

I search on Dart documentation, stackoverflow for answers but could find a thing. Could you please explain me the getter syntax, especially why does it returns Future<Marker> Function(Cluster) and what does it means ?

Best

bpillon commented 3 years ago

Hello Maxouille. MarkerBuilder expects a Function that takes a Cluster object in parameter and return a Future. This syntax could be close to a method with Future<Marker> getMarker(Cluster cluster) {...} as signature.

maxouille commented 3 years ago

Thanks so the Function() keyword on the getter is only there to tell that the getter takes a cluster as parameter if I'm correct ?

bpillon commented 3 years ago

Yes. It tells that the getter returns a function which takes a Cluster as parameter a return a Future<Marker>.

maxouille commented 3 years ago

Thx, i close the issue :)