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

Unable to initialise value in Marker's onTap function if using #72

Open PriyanshuNatani opened 1 month ago

PriyanshuNatani commented 1 month ago

I want to change color of selected marker so i made a logic so to use this logic i want to change or replace the current value of variable for example: isSelected = true;

static Future Function(Cluster) get markerBuilder => (cluster) async { return Marker( markerId: MarkerId(cluster.getId()), position: cluster.location, onTap: () { isSelected = true; // This gives me error }, icon: await getClusterBitmap(cluster.isMultiple ? 125 : 75, text: cluster.isMultiple? cluster.count.toString() : null), ); };

the reasons to i am unable to add new value on tap is this type of get function. if it is a normal function we can do it. Future Function(Cluster) get markerBuilder => (cluster)

so please what is problem explain me