Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 6d1f27f

Browse files
author
Emmanuel Garcia
committed
prevent potential race
1 parent 6b2c68d commit 6d1f27f

File tree

1 file changed

+7
-7
lines changed
  • packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps

1 file changed

+7
-7
lines changed

packages/google_maps_flutter/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,14 @@ public void onSnapshotReady(Bitmap bitmap) {
303303
}
304304
case "markers#update":
305305
{
306+
invalidateMapIfNeeded();
306307
List<Object> markersToAdd = call.argument("markersToAdd");
307308
markersController.addMarkers(markersToAdd);
308309
List<Object> markersToChange = call.argument("markersToChange");
309310
markersController.changeMarkers(markersToChange);
310311
List<Object> markerIdsToRemove = call.argument("markerIdsToRemove");
311312
markersController.removeMarkers(markerIdsToRemove);
312313
result.success(null);
313-
invalidateMapIfNeeded();
314314
break;
315315
}
316316
case "markers#showInfoWindow":
@@ -333,38 +333,38 @@ public void onSnapshotReady(Bitmap bitmap) {
333333
}
334334
case "polygons#update":
335335
{
336+
invalidateMapIfNeeded();
336337
List<Object> polygonsToAdd = call.argument("polygonsToAdd");
337338
polygonsController.addPolygons(polygonsToAdd);
338339
List<Object> polygonsToChange = call.argument("polygonsToChange");
339340
polygonsController.changePolygons(polygonsToChange);
340341
List<Object> polygonIdsToRemove = call.argument("polygonIdsToRemove");
341342
polygonsController.removePolygons(polygonIdsToRemove);
342343
result.success(null);
343-
invalidateMapIfNeeded();
344344
break;
345345
}
346346
case "polylines#update":
347347
{
348+
invalidateMapIfNeeded();
348349
List<Object> polylinesToAdd = call.argument("polylinesToAdd");
349350
polylinesController.addPolylines(polylinesToAdd);
350351
List<Object> polylinesToChange = call.argument("polylinesToChange");
351352
polylinesController.changePolylines(polylinesToChange);
352353
List<Object> polylineIdsToRemove = call.argument("polylineIdsToRemove");
353354
polylinesController.removePolylines(polylineIdsToRemove);
354355
result.success(null);
355-
invalidateMapIfNeeded();
356356
break;
357357
}
358358
case "circles#update":
359359
{
360+
invalidateMapIfNeeded();
360361
List<Object> circlesToAdd = call.argument("circlesToAdd");
361362
circlesController.addCircles(circlesToAdd);
362363
List<Object> circlesToChange = call.argument("circlesToChange");
363364
circlesController.changeCircles(circlesToChange);
364365
List<Object> circleIdsToRemove = call.argument("circleIdsToRemove");
365366
circlesController.removeCircles(circleIdsToRemove);
366367
result.success(null);
367-
invalidateMapIfNeeded();
368368
break;
369369
}
370370
case "map#isCompassEnabled":
@@ -437,6 +437,7 @@ public void onSnapshotReady(Bitmap bitmap) {
437437
}
438438
case "map#setStyle":
439439
{
440+
invalidateMapIfNeeded();
440441
boolean mapStyleSet;
441442
if (call.arguments instanceof String) {
442443
String mapStyle = (String) call.arguments;
@@ -455,26 +456,25 @@ public void onSnapshotReady(Bitmap bitmap) {
455456
"Unable to set the map style. Please check console logs for errors.");
456457
}
457458
result.success(mapStyleResult);
458-
invalidateMapIfNeeded();
459459
break;
460460
}
461461
case "tileOverlays#update":
462462
{
463+
invalidateMapIfNeeded();
463464
List<Map<String, ?>> tileOverlaysToAdd = call.argument("tileOverlaysToAdd");
464465
tileOverlaysController.addTileOverlays(tileOverlaysToAdd);
465466
List<Map<String, ?>> tileOverlaysToChange = call.argument("tileOverlaysToChange");
466467
tileOverlaysController.changeTileOverlays(tileOverlaysToChange);
467468
List<String> tileOverlaysToRemove = call.argument("tileOverlayIdsToRemove");
468469
tileOverlaysController.removeTileOverlays(tileOverlaysToRemove);
469470
result.success(null);
470-
invalidateMapIfNeeded();
471471
break;
472472
}
473473
case "tileOverlays#clearTileCache":
474474
{
475+
invalidateMapIfNeeded();
475476
String tileOverlayId = call.argument("tileOverlayId");
476477
tileOverlaysController.clearTileCache(tileOverlayId);
477-
invalidateMapIfNeeded();
478478
result.success(null);
479479
break;
480480
}

0 commit comments

Comments
 (0)