bpillon/google_maps_cluster_manager

Syntax question about markerBuilder

Closed this issue · 4 comments

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

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.

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 ?

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

Thx, i close the issue :)