diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index 280ec0de9aa2..68385a54afcc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.18.9 + +* Updates heatmaps passed between Dart and native to use typed data. + ## 2.18.8 * Bumps com.google.maps.android:android-maps-utils from 3.6.0 to 3.19.1. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java index 44765122a1fb..a61a888c62ea 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java @@ -47,21 +47,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; /** Conversions between JSON-like values and GoogleMaps data types. */ class Convert { - // These constants must match the corresponding constants in serialization.dart - public static final String HEATMAP_ID_KEY = "heatmapId"; - public static final String HEATMAP_DATA_KEY = "data"; - public static final String HEATMAP_GRADIENT_KEY = "gradient"; - public static final String HEATMAP_MAX_INTENSITY_KEY = "maxIntensity"; - public static final String HEATMAP_OPACITY_KEY = "opacity"; - public static final String HEATMAP_RADIUS_KEY = "radius"; - public static final String HEATMAP_GRADIENT_COLORS_KEY = "colors"; - public static final String HEATMAP_GRADIENT_START_POINTS_KEY = "startPoints"; - public static final String HEATMAP_GRADIENT_COLOR_MAP_SIZE_KEY = "colorMapSize"; - private static BitmapDescriptor toBitmapDescriptor( Messages.PlatformBitmap platformBitmap, AssetManager assetManager, float density) { return toBitmapDescriptor( @@ -328,14 +316,6 @@ static CameraUpdate cameraUpdateFromPigeon(Messages.PlatformCameraUpdate update, "PlatformCameraUpdate's cameraUpdate field must be one of the PlatformCameraUpdate... case classes."); } - private static double toDouble(Object o) { - return ((Number) o).doubleValue(); - } - - private static float toFloat(Object o) { - return ((Number) o).floatValue(); - } - private static @Nullable Float nullableDoubleToFloat(@Nullable Double d) { return (d == null) ? null : d.floatValue(); } @@ -437,20 +417,15 @@ static Messages.PlatformCluster clusterToPigeon( .build(); } - static LatLng toLatLng(Object o) { - final List data = toList(o); - return new LatLng(toDouble(data.get(0)), toDouble(data.get(1))); - } - /** - * Converts a list of serialized weighted lat/lng to a list of WeightedLatLng. + * Converts a Pigeon weighted lat/lng to a WeightedLatLng. * - * @param o The serialized list of weighted lat/lng. + * @param weightedLatLng The Pigeon weighted lat/lng. * @return The list of WeightedLatLng. */ - static WeightedLatLng toWeightedLatLng(Object o) { - final List data = toList(o); - return new WeightedLatLng(toLatLng(data.get(0)), toDouble(data.get(1))); + static WeightedLatLng weightedLatLngFromPigeon(Messages.PlatformWeightedLatLng weightedLatLng) { + return new WeightedLatLng( + latLngFromPigeon(weightedLatLng.getPoint()), weightedLatLng.getWeight()); } static Point pointFromPigeon(Messages.PlatformPoint point) { @@ -469,14 +444,6 @@ static Messages.PlatformPoint pointToPigeon(Point point) { return new Messages.PlatformPoint.Builder().setX((long) point.x).setY((long) point.y).build(); } - private static List toList(Object o) { - return (List) o; - } - - private static Map toMap(Object o) { - return (Map) o; - } - private static Bitmap toBitmap(byte[] bmpData) { Bitmap bitmap = BitmapFactory.decodeByteArray(bmpData, 0, bmpData.length); if (bitmap == null) { @@ -606,7 +573,7 @@ static void interpretMarkerOptions( sink.setFlat(marker.getFlat()); sink.setIcon(toBitmapDescriptor(marker.getIcon(), assetManager, density, wrapper)); interpretInfoWindowOptions(sink, marker.getInfoWindow()); - sink.setPosition(toLatLng(marker.getPosition().toList())); + sink.setPosition(latLngFromPigeon(marker.getPosition())); sink.setRotation(marker.getRotation().floatValue()); sink.setVisible(marker.getVisible()); sink.setZIndex(marker.getZIndex().floatValue()); @@ -673,7 +640,7 @@ static String interpretCircleOptions(Messages.PlatformCircle circle, CircleOptio sink.setStrokeColor(circle.getStrokeColor().getArgbValue().intValue()); sink.setStrokeWidth(circle.getStrokeWidth()); sink.setZIndex(circle.getZIndex().floatValue()); - sink.setCenter(toLatLng(circle.getCenter().toList())); + sink.setCenter(latLngFromPigeon(circle.getCenter())); sink.setRadius(circle.getRadius()); sink.setVisible(circle.getVisible()); return circle.getCircleId(); @@ -699,33 +666,19 @@ static String interpretCircleOptions(Messages.PlatformCircle circle, CircleOptio * @return the heatmapId. * @throws IllegalArgumentException if heatmapId is null. */ - static String interpretHeatmapOptions(Map data, HeatmapOptionsSink sink) { - final Object rawWeightedData = data.get(HEATMAP_DATA_KEY); - if (rawWeightedData != null) { - sink.setWeightedData(toWeightedData(rawWeightedData)); - } - final Object gradient = data.get(HEATMAP_GRADIENT_KEY); + static String interpretHeatmapOptions(Messages.PlatformHeatmap heatmap, HeatmapOptionsSink sink) { + sink.setWeightedData(weightedDataFromPigeon(heatmap.getData())); + final Messages.PlatformHeatmapGradient gradient = heatmap.getGradient(); if (gradient != null) { - sink.setGradient(toGradient(gradient)); + sink.setGradient(gradientFromPigeon(gradient)); } - final Object maxIntensity = data.get(HEATMAP_MAX_INTENSITY_KEY); + final Double maxIntensity = heatmap.getMaxIntensity(); if (maxIntensity != null) { - sink.setMaxIntensity(toDouble(maxIntensity)); - } - final Object opacity = data.get(HEATMAP_OPACITY_KEY); - if (opacity != null) { - sink.setOpacity(toDouble(opacity)); - } - final Object radius = data.get(HEATMAP_RADIUS_KEY); - if (radius != null) { - sink.setRadius(toInt(radius)); - } - final String heatmapId = (String) data.get(HEATMAP_ID_KEY); - if (heatmapId == null) { - throw new IllegalArgumentException("heatmapId was null"); - } else { - return heatmapId; + sink.setMaxIntensity(maxIntensity); } + sink.setOpacity(heatmap.getOpacity()); + sink.setRadius(heatmap.getRadius().intValue()); + return heatmap.getHeatmapId(); } static List pointsFromPigeon(List data) { @@ -740,57 +693,40 @@ static List pointsFromPigeon(List data) { /** * Converts the given object to a list of WeightedLatLng objects. * - * @param o the object to convert. The object is expected to be a List of serialized weighted - * lat/lng. + * @param data the list of Pigeon weighted lat/lng objects to convert. * @return a list of WeightedLatLng objects. */ @VisibleForTesting - static List toWeightedData(Object o) { - final List data = toList(o); + static List weightedDataFromPigeon(List data) { final List weightedData = new ArrayList<>(data.size()); - for (Object rawWeightedPoint : data) { - weightedData.add(toWeightedLatLng(rawWeightedPoint)); + for (Messages.PlatformWeightedLatLng rawWeightedPoint : data) { + weightedData.add(weightedLatLngFromPigeon(rawWeightedPoint)); } return weightedData; } /** - * Converts the given object to a Gradient object. - * - * @param o the object to convert. The object is expected to be a Map containing the gradient - * options. The gradient map is expected to have the following structure: - *
{@code
-   * {
-   *   "colors": List,
-   *   "startPoints": List,
-   *   "colorMapSize": Integer
-   * }
-   * }
+ * Converts the given Pigeon gradient to a Gradient object. * + * @param gradient the Pigeon gradient to convert. * @return a Gradient object. */ @VisibleForTesting - static Gradient toGradient(Object o) { - final Map data = toMap(o); - - final List colorData = toList(data.get(HEATMAP_GRADIENT_COLORS_KEY)); - assert colorData != null; + static Gradient gradientFromPigeon(Messages.PlatformHeatmapGradient gradient) { + final List colorData = gradient.getColors(); final int[] colors = new int[colorData.size()]; for (int i = 0; i < colorData.size(); i++) { - colors[i] = toInt(colorData.get(i)); + colors[i] = colorData.get(i).getArgbValue().intValue(); } - final List startPointData = toList(data.get(HEATMAP_GRADIENT_START_POINTS_KEY)); - assert startPointData != null; + final List startPointData = gradient.getStartPoints(); final float[] startPoints = new float[startPointData.size()]; for (int i = 0; i < startPointData.size(); i++) { - startPoints[i] = toFloat(startPointData.get(i)); + startPoints[i] = startPointData.get(i).floatValue(); } - final int colorMapSize = toInt(data.get(HEATMAP_GRADIENT_COLOR_MAP_SIZE_KEY)); - - return new Gradient(colors, startPoints, colorMapSize); + return new Gradient(colors, startPoints, gradient.getColorMapSize().intValue()); } private static List> toHoles(List> data) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java index 9f83c13b2d7a..2f8f45ca6b52 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java @@ -4,8 +4,6 @@ package io.flutter.plugins.googlemaps; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_ID_KEY; - import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.google.android.gms.maps.GoogleMap; @@ -36,14 +34,22 @@ void setGoogleMap(GoogleMap googleMap) { /** Adds heatmaps to the map. */ void addHeatmaps(@NonNull List heatmapsToAdd) { for (Messages.PlatformHeatmap heatmapToAdd : heatmapsToAdd) { - addJsonHeatmap(heatmapToAdd.getJson()); + HeatmapBuilder heatmapBuilder = new HeatmapBuilder(); + String heatmapId = Convert.interpretHeatmapOptions(heatmapToAdd, heatmapBuilder); + HeatmapTileProvider options = buildHeatmap(heatmapBuilder); + addHeatmap(heatmapId, options); } } /** Updates the given heatmaps on the map. */ void changeHeatmaps(@NonNull List heatmapsToChange) { for (Messages.PlatformHeatmap heatmapToChange : heatmapsToChange) { - changeJsonHeatmap(heatmapToChange.getJson()); + String heatmapId = heatmapToChange.getHeatmapId(); + HeatmapController heatmapController = heatmapIdToController.get(heatmapId); + if (heatmapController != null) { + Convert.interpretHeatmapOptions(heatmapToChange, heatmapController); + heatmapController.clearTileCache(); + } } } @@ -64,17 +70,6 @@ void removeHeatmaps(@NonNull List heatmapIdsToRemove) { return builder.build(); } - /** Adds a heatmap to the map from json data. */ - private void addJsonHeatmap(Map heatmap) { - if (heatmap == null) { - return; - } - HeatmapBuilder heatmapBuilder = new HeatmapBuilder(); - String heatmapId = Convert.interpretHeatmapOptions(heatmap, heatmapBuilder); - HeatmapTileProvider options = buildHeatmap(heatmapBuilder); - addHeatmap(heatmapId, options); - } - /** Adds a heatmap to the map. */ private void addHeatmap(String heatmapId, HeatmapTileProvider options) { TileOverlay heatmapTileOverlay = @@ -82,22 +77,4 @@ private void addHeatmap(String heatmapId, HeatmapTileProvider options) { HeatmapController heatmapController = new HeatmapController(options, heatmapTileOverlay); heatmapIdToController.put(heatmapId, heatmapController); } - - /** Updates the given heatmap on the map. */ - private void changeJsonHeatmap(Map heatmap) { - if (heatmap == null) { - return; - } - String heatmapId = getHeatmapId(heatmap); - HeatmapController heatmapController = heatmapIdToController.get(heatmapId); - if (heatmapController != null) { - Convert.interpretHeatmapOptions(heatmap, heatmapController); - heatmapController.clearTileCache(); - } - } - - /** Returns the heatmap id from the given heatmap data. */ - private static String getHeatmapId(Map heatmap) { - return (String) heatmap.get(HEATMAP_ID_KEY); - } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java index d37e4854fbab..f8d44e8c4bf9 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. +// Autogenerated from Pigeon (v26.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.googlemaps; @@ -24,7 +24,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -1349,21 +1348,76 @@ ArrayList toList() { *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformHeatmap { - /** - * The heatmap data, as JSON. This should only be set from Heatmap.toJson, and the native code - * must interpret it according to the internal implementation details of that method. - */ - private @NonNull Map json; + private @NonNull String heatmapId; + + public @NonNull String getHeatmapId() { + return heatmapId; + } + + public void setHeatmapId(@NonNull String setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"heatmapId\" is null."); + } + this.heatmapId = setterArg; + } + + private @NonNull List data; + + public @NonNull List getData() { + return data; + } + + public void setData(@NonNull List setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"data\" is null."); + } + this.data = setterArg; + } + + private @Nullable PlatformHeatmapGradient gradient; + + public @Nullable PlatformHeatmapGradient getGradient() { + return gradient; + } - public @NonNull Map getJson() { - return json; + public void setGradient(@Nullable PlatformHeatmapGradient setterArg) { + this.gradient = setterArg; } - public void setJson(@NonNull Map setterArg) { + private @NonNull Double opacity; + + public @NonNull Double getOpacity() { + return opacity; + } + + public void setOpacity(@NonNull Double setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"opacity\" is null."); + } + this.opacity = setterArg; + } + + private @NonNull Long radius; + + public @NonNull Long getRadius() { + return radius; + } + + public void setRadius(@NonNull Long setterArg) { if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"json\" is null."); + throw new IllegalStateException("Nonnull field \"radius\" is null."); } - this.json = setterArg; + this.radius = setterArg; + } + + private @Nullable Double maxIntensity; + + public @Nullable Double getMaxIntensity() { + return maxIntensity; + } + + public void setMaxIntensity(@Nullable Double setterArg) { + this.maxIntensity = setterArg; } /** Constructor is non-public to enforce null safety; use Builder. */ @@ -1378,42 +1432,330 @@ public boolean equals(Object o) { return false; } PlatformHeatmap that = (PlatformHeatmap) o; - return json.equals(that.json); + return heatmapId.equals(that.heatmapId) + && data.equals(that.data) + && Objects.equals(gradient, that.gradient) + && opacity.equals(that.opacity) + && radius.equals(that.radius) + && Objects.equals(maxIntensity, that.maxIntensity); } @Override public int hashCode() { - return Objects.hash(json); + return Objects.hash(heatmapId, data, gradient, opacity, radius, maxIntensity); } public static final class Builder { - private @Nullable Map json; + private @Nullable String heatmapId; + + @CanIgnoreReturnValue + public @NonNull Builder setHeatmapId(@NonNull String setterArg) { + this.heatmapId = setterArg; + return this; + } + + private @Nullable List data; + + @CanIgnoreReturnValue + public @NonNull Builder setData(@NonNull List setterArg) { + this.data = setterArg; + return this; + } + + private @Nullable PlatformHeatmapGradient gradient; + + @CanIgnoreReturnValue + public @NonNull Builder setGradient(@Nullable PlatformHeatmapGradient setterArg) { + this.gradient = setterArg; + return this; + } + + private @Nullable Double opacity; + + @CanIgnoreReturnValue + public @NonNull Builder setOpacity(@NonNull Double setterArg) { + this.opacity = setterArg; + return this; + } + + private @Nullable Long radius; @CanIgnoreReturnValue - public @NonNull Builder setJson(@NonNull Map setterArg) { - this.json = setterArg; + public @NonNull Builder setRadius(@NonNull Long setterArg) { + this.radius = setterArg; + return this; + } + + private @Nullable Double maxIntensity; + + @CanIgnoreReturnValue + public @NonNull Builder setMaxIntensity(@Nullable Double setterArg) { + this.maxIntensity = setterArg; return this; } public @NonNull PlatformHeatmap build() { PlatformHeatmap pigeonReturn = new PlatformHeatmap(); - pigeonReturn.setJson(json); + pigeonReturn.setHeatmapId(heatmapId); + pigeonReturn.setData(data); + pigeonReturn.setGradient(gradient); + pigeonReturn.setOpacity(opacity); + pigeonReturn.setRadius(radius); + pigeonReturn.setMaxIntensity(maxIntensity); return pigeonReturn; } } @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(json); + ArrayList toListResult = new ArrayList<>(6); + toListResult.add(heatmapId); + toListResult.add(data); + toListResult.add(gradient); + toListResult.add(opacity); + toListResult.add(radius); + toListResult.add(maxIntensity); return toListResult; } static @NonNull PlatformHeatmap fromList(@NonNull ArrayList pigeonVar_list) { PlatformHeatmap pigeonResult = new PlatformHeatmap(); - Object json = pigeonVar_list.get(0); - pigeonResult.setJson((Map) json); + Object heatmapId = pigeonVar_list.get(0); + pigeonResult.setHeatmapId((String) heatmapId); + Object data = pigeonVar_list.get(1); + pigeonResult.setData((List) data); + Object gradient = pigeonVar_list.get(2); + pigeonResult.setGradient((PlatformHeatmapGradient) gradient); + Object opacity = pigeonVar_list.get(3); + pigeonResult.setOpacity((Double) opacity); + Object radius = pigeonVar_list.get(4); + pigeonResult.setRadius((Long) radius); + Object maxIntensity = pigeonVar_list.get(5); + pigeonResult.setMaxIntensity((Double) maxIntensity); + return pigeonResult; + } + } + + /** + * Pigeon equivalent of the HeatmapGradient class. + * + *

The Java Gradient structure is slightly different from HeatmapGradient, so this matches the + * Android API so that conversion can be done on the Dart side where the structures are easier to + * work with. + * + *

Generated class from Pigeon that represents data sent in messages. + */ + public static final class PlatformHeatmapGradient { + private @NonNull List colors; + + public @NonNull List getColors() { + return colors; + } + + public void setColors(@NonNull List setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"colors\" is null."); + } + this.colors = setterArg; + } + + private @NonNull List startPoints; + + public @NonNull List getStartPoints() { + return startPoints; + } + + public void setStartPoints(@NonNull List setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"startPoints\" is null."); + } + this.startPoints = setterArg; + } + + private @NonNull Long colorMapSize; + + public @NonNull Long getColorMapSize() { + return colorMapSize; + } + + public void setColorMapSize(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"colorMapSize\" is null."); + } + this.colorMapSize = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + PlatformHeatmapGradient() {} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlatformHeatmapGradient that = (PlatformHeatmapGradient) o; + return colors.equals(that.colors) + && startPoints.equals(that.startPoints) + && colorMapSize.equals(that.colorMapSize); + } + + @Override + public int hashCode() { + return Objects.hash(colors, startPoints, colorMapSize); + } + + public static final class Builder { + + private @Nullable List colors; + + @CanIgnoreReturnValue + public @NonNull Builder setColors(@NonNull List setterArg) { + this.colors = setterArg; + return this; + } + + private @Nullable List startPoints; + + @CanIgnoreReturnValue + public @NonNull Builder setStartPoints(@NonNull List setterArg) { + this.startPoints = setterArg; + return this; + } + + private @Nullable Long colorMapSize; + + @CanIgnoreReturnValue + public @NonNull Builder setColorMapSize(@NonNull Long setterArg) { + this.colorMapSize = setterArg; + return this; + } + + public @NonNull PlatformHeatmapGradient build() { + PlatformHeatmapGradient pigeonReturn = new PlatformHeatmapGradient(); + pigeonReturn.setColors(colors); + pigeonReturn.setStartPoints(startPoints); + pigeonReturn.setColorMapSize(colorMapSize); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(3); + toListResult.add(colors); + toListResult.add(startPoints); + toListResult.add(colorMapSize); + return toListResult; + } + + static @NonNull PlatformHeatmapGradient fromList(@NonNull ArrayList pigeonVar_list) { + PlatformHeatmapGradient pigeonResult = new PlatformHeatmapGradient(); + Object colors = pigeonVar_list.get(0); + pigeonResult.setColors((List) colors); + Object startPoints = pigeonVar_list.get(1); + pigeonResult.setStartPoints((List) startPoints); + Object colorMapSize = pigeonVar_list.get(2); + pigeonResult.setColorMapSize((Long) colorMapSize); + return pigeonResult; + } + } + + /** + * Pigeon equivalent of the WeightedLatLng class. + * + *

Generated class from Pigeon that represents data sent in messages. + */ + public static final class PlatformWeightedLatLng { + private @NonNull PlatformLatLng point; + + public @NonNull PlatformLatLng getPoint() { + return point; + } + + public void setPoint(@NonNull PlatformLatLng setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"point\" is null."); + } + this.point = setterArg; + } + + private @NonNull Double weight; + + public @NonNull Double getWeight() { + return weight; + } + + public void setWeight(@NonNull Double setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"weight\" is null."); + } + this.weight = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + PlatformWeightedLatLng() {} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlatformWeightedLatLng that = (PlatformWeightedLatLng) o; + return point.equals(that.point) && weight.equals(that.weight); + } + + @Override + public int hashCode() { + return Objects.hash(point, weight); + } + + public static final class Builder { + + private @Nullable PlatformLatLng point; + + @CanIgnoreReturnValue + public @NonNull Builder setPoint(@NonNull PlatformLatLng setterArg) { + this.point = setterArg; + return this; + } + + private @Nullable Double weight; + + @CanIgnoreReturnValue + public @NonNull Builder setWeight(@NonNull Double setterArg) { + this.weight = setterArg; + return this; + } + + public @NonNull PlatformWeightedLatLng build() { + PlatformWeightedLatLng pigeonReturn = new PlatformWeightedLatLng(); + pigeonReturn.setPoint(point); + pigeonReturn.setWeight(weight); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(point); + toListResult.add(weight); + return toListResult; + } + + static @NonNull PlatformWeightedLatLng fromList(@NonNull ArrayList pigeonVar_list) { + PlatformWeightedLatLng pigeonResult = new PlatformWeightedLatLng(); + Object point = pigeonVar_list.get(0); + pigeonResult.setPoint((PlatformLatLng) point); + Object weight = pigeonVar_list.get(1); + pigeonResult.setWeight((Double) weight); return pigeonResult; } } @@ -6344,62 +6686,66 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 146: return PlatformHeatmap.fromList((ArrayList) readValue(buffer)); case (byte) 147: - return PlatformClusterManager.fromList((ArrayList) readValue(buffer)); + return PlatformHeatmapGradient.fromList((ArrayList) readValue(buffer)); case (byte) 148: - return PlatformDoublePair.fromList((ArrayList) readValue(buffer)); + return PlatformWeightedLatLng.fromList((ArrayList) readValue(buffer)); case (byte) 149: - return PlatformColor.fromList((ArrayList) readValue(buffer)); + return PlatformClusterManager.fromList((ArrayList) readValue(buffer)); case (byte) 150: - return PlatformInfoWindow.fromList((ArrayList) readValue(buffer)); + return PlatformDoublePair.fromList((ArrayList) readValue(buffer)); case (byte) 151: - return PlatformMarker.fromList((ArrayList) readValue(buffer)); + return PlatformColor.fromList((ArrayList) readValue(buffer)); case (byte) 152: - return PlatformPolygon.fromList((ArrayList) readValue(buffer)); + return PlatformInfoWindow.fromList((ArrayList) readValue(buffer)); case (byte) 153: - return PlatformPolyline.fromList((ArrayList) readValue(buffer)); + return PlatformMarker.fromList((ArrayList) readValue(buffer)); case (byte) 154: - return PlatformCap.fromList((ArrayList) readValue(buffer)); + return PlatformPolygon.fromList((ArrayList) readValue(buffer)); case (byte) 155: - return PlatformPatternItem.fromList((ArrayList) readValue(buffer)); + return PlatformPolyline.fromList((ArrayList) readValue(buffer)); case (byte) 156: - return PlatformTile.fromList((ArrayList) readValue(buffer)); + return PlatformCap.fromList((ArrayList) readValue(buffer)); case (byte) 157: - return PlatformTileOverlay.fromList((ArrayList) readValue(buffer)); + return PlatformPatternItem.fromList((ArrayList) readValue(buffer)); case (byte) 158: - return PlatformEdgeInsets.fromList((ArrayList) readValue(buffer)); + return PlatformTile.fromList((ArrayList) readValue(buffer)); case (byte) 159: - return PlatformLatLng.fromList((ArrayList) readValue(buffer)); + return PlatformTileOverlay.fromList((ArrayList) readValue(buffer)); case (byte) 160: - return PlatformLatLngBounds.fromList((ArrayList) readValue(buffer)); + return PlatformEdgeInsets.fromList((ArrayList) readValue(buffer)); case (byte) 161: - return PlatformCluster.fromList((ArrayList) readValue(buffer)); + return PlatformLatLng.fromList((ArrayList) readValue(buffer)); case (byte) 162: - return PlatformGroundOverlay.fromList((ArrayList) readValue(buffer)); + return PlatformLatLngBounds.fromList((ArrayList) readValue(buffer)); case (byte) 163: - return PlatformCameraTargetBounds.fromList((ArrayList) readValue(buffer)); + return PlatformCluster.fromList((ArrayList) readValue(buffer)); case (byte) 164: - return PlatformMapViewCreationParams.fromList((ArrayList) readValue(buffer)); + return PlatformGroundOverlay.fromList((ArrayList) readValue(buffer)); case (byte) 165: - return PlatformMapConfiguration.fromList((ArrayList) readValue(buffer)); + return PlatformCameraTargetBounds.fromList((ArrayList) readValue(buffer)); case (byte) 166: - return PlatformPoint.fromList((ArrayList) readValue(buffer)); + return PlatformMapViewCreationParams.fromList((ArrayList) readValue(buffer)); case (byte) 167: - return PlatformTileLayer.fromList((ArrayList) readValue(buffer)); + return PlatformMapConfiguration.fromList((ArrayList) readValue(buffer)); case (byte) 168: - return PlatformZoomRange.fromList((ArrayList) readValue(buffer)); + return PlatformPoint.fromList((ArrayList) readValue(buffer)); case (byte) 169: - return PlatformBitmap.fromList((ArrayList) readValue(buffer)); + return PlatformTileLayer.fromList((ArrayList) readValue(buffer)); case (byte) 170: - return PlatformBitmapDefaultMarker.fromList((ArrayList) readValue(buffer)); + return PlatformZoomRange.fromList((ArrayList) readValue(buffer)); case (byte) 171: - return PlatformBitmapBytes.fromList((ArrayList) readValue(buffer)); + return PlatformBitmap.fromList((ArrayList) readValue(buffer)); case (byte) 172: - return PlatformBitmapAsset.fromList((ArrayList) readValue(buffer)); + return PlatformBitmapDefaultMarker.fromList((ArrayList) readValue(buffer)); case (byte) 173: - return PlatformBitmapAssetImage.fromList((ArrayList) readValue(buffer)); + return PlatformBitmapBytes.fromList((ArrayList) readValue(buffer)); case (byte) 174: - return PlatformBitmapAssetMap.fromList((ArrayList) readValue(buffer)); + return PlatformBitmapAsset.fromList((ArrayList) readValue(buffer)); case (byte) 175: + return PlatformBitmapAssetImage.fromList((ArrayList) readValue(buffer)); + case (byte) 176: + return PlatformBitmapAssetMap.fromList((ArrayList) readValue(buffer)); + case (byte) 177: return PlatformBitmapBytesMap.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); @@ -6462,92 +6808,98 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } else if (value instanceof PlatformHeatmap) { stream.write(146); writeValue(stream, ((PlatformHeatmap) value).toList()); - } else if (value instanceof PlatformClusterManager) { + } else if (value instanceof PlatformHeatmapGradient) { stream.write(147); + writeValue(stream, ((PlatformHeatmapGradient) value).toList()); + } else if (value instanceof PlatformWeightedLatLng) { + stream.write(148); + writeValue(stream, ((PlatformWeightedLatLng) value).toList()); + } else if (value instanceof PlatformClusterManager) { + stream.write(149); writeValue(stream, ((PlatformClusterManager) value).toList()); } else if (value instanceof PlatformDoublePair) { - stream.write(148); + stream.write(150); writeValue(stream, ((PlatformDoublePair) value).toList()); } else if (value instanceof PlatformColor) { - stream.write(149); + stream.write(151); writeValue(stream, ((PlatformColor) value).toList()); } else if (value instanceof PlatformInfoWindow) { - stream.write(150); + stream.write(152); writeValue(stream, ((PlatformInfoWindow) value).toList()); } else if (value instanceof PlatformMarker) { - stream.write(151); + stream.write(153); writeValue(stream, ((PlatformMarker) value).toList()); } else if (value instanceof PlatformPolygon) { - stream.write(152); + stream.write(154); writeValue(stream, ((PlatformPolygon) value).toList()); } else if (value instanceof PlatformPolyline) { - stream.write(153); + stream.write(155); writeValue(stream, ((PlatformPolyline) value).toList()); } else if (value instanceof PlatformCap) { - stream.write(154); + stream.write(156); writeValue(stream, ((PlatformCap) value).toList()); } else if (value instanceof PlatformPatternItem) { - stream.write(155); + stream.write(157); writeValue(stream, ((PlatformPatternItem) value).toList()); } else if (value instanceof PlatformTile) { - stream.write(156); + stream.write(158); writeValue(stream, ((PlatformTile) value).toList()); } else if (value instanceof PlatformTileOverlay) { - stream.write(157); + stream.write(159); writeValue(stream, ((PlatformTileOverlay) value).toList()); } else if (value instanceof PlatformEdgeInsets) { - stream.write(158); + stream.write(160); writeValue(stream, ((PlatformEdgeInsets) value).toList()); } else if (value instanceof PlatformLatLng) { - stream.write(159); + stream.write(161); writeValue(stream, ((PlatformLatLng) value).toList()); } else if (value instanceof PlatformLatLngBounds) { - stream.write(160); + stream.write(162); writeValue(stream, ((PlatformLatLngBounds) value).toList()); } else if (value instanceof PlatformCluster) { - stream.write(161); + stream.write(163); writeValue(stream, ((PlatformCluster) value).toList()); } else if (value instanceof PlatformGroundOverlay) { - stream.write(162); + stream.write(164); writeValue(stream, ((PlatformGroundOverlay) value).toList()); } else if (value instanceof PlatformCameraTargetBounds) { - stream.write(163); + stream.write(165); writeValue(stream, ((PlatformCameraTargetBounds) value).toList()); } else if (value instanceof PlatformMapViewCreationParams) { - stream.write(164); + stream.write(166); writeValue(stream, ((PlatformMapViewCreationParams) value).toList()); } else if (value instanceof PlatformMapConfiguration) { - stream.write(165); + stream.write(167); writeValue(stream, ((PlatformMapConfiguration) value).toList()); } else if (value instanceof PlatformPoint) { - stream.write(166); + stream.write(168); writeValue(stream, ((PlatformPoint) value).toList()); } else if (value instanceof PlatformTileLayer) { - stream.write(167); + stream.write(169); writeValue(stream, ((PlatformTileLayer) value).toList()); } else if (value instanceof PlatformZoomRange) { - stream.write(168); + stream.write(170); writeValue(stream, ((PlatformZoomRange) value).toList()); } else if (value instanceof PlatformBitmap) { - stream.write(169); + stream.write(171); writeValue(stream, ((PlatformBitmap) value).toList()); } else if (value instanceof PlatformBitmapDefaultMarker) { - stream.write(170); + stream.write(172); writeValue(stream, ((PlatformBitmapDefaultMarker) value).toList()); } else if (value instanceof PlatformBitmapBytes) { - stream.write(171); + stream.write(173); writeValue(stream, ((PlatformBitmapBytes) value).toList()); } else if (value instanceof PlatformBitmapAsset) { - stream.write(172); + stream.write(174); writeValue(stream, ((PlatformBitmapAsset) value).toList()); } else if (value instanceof PlatformBitmapAssetImage) { - stream.write(173); + stream.write(175); writeValue(stream, ((PlatformBitmapAssetImage) value).toList()); } else if (value instanceof PlatformBitmapAssetMap) { - stream.write(174); + stream.write(176); writeValue(stream, ((PlatformBitmapAssetMap) value).toList()); } else if (value instanceof PlatformBitmapBytesMap) { - stream.write(175); + stream.write(177); writeValue(stream, ((PlatformBitmapBytesMap) value).toList()); } else { super.writeValue(stream, value); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java index 6f9d66ed56cf..56949c20d85b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java @@ -5,15 +5,6 @@ package io.flutter.plugins.googlemaps; import static com.google.android.gms.maps.GoogleMap.MAP_TYPE_HYBRID; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_DATA_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_GRADIENT_COLORS_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_GRADIENT_COLOR_MAP_SIZE_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_GRADIENT_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_GRADIENT_START_POINTS_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_ID_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_MAX_INTENSITY_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_OPACITY_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_RADIUS_KEY; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -39,7 +30,6 @@ import io.flutter.plugins.googlemaps.Convert.FlutterInjectorWrapper; import java.util.Collections; import java.util.List; -import java.util.Map; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -540,10 +530,15 @@ public void interpretMapConfiguration_handlesMinMaxZoomPreference() { @Test() public void ConvertToWeightedLatLngReturnsCorrectData() { final double intensity = 3.3; - final Object data = List.of(List.of(1.1, 2.2), intensity); + final Messages.PlatformWeightedLatLng data = + new Messages.PlatformWeightedLatLng.Builder() + .setPoint( + new Messages.PlatformLatLng.Builder().setLatitude(1.1).setLongitude(2.2).build()) + .setWeight(intensity) + .build(); final Point point = sProjection.toPoint(new LatLng(1.1, 2.2)); - final WeightedLatLng result = Convert.toWeightedLatLng(data); + final WeightedLatLng result = Convert.weightedLatLngFromPigeon(data); Assert.assertEquals(point.x, result.getPoint().x, 0); Assert.assertEquals(point.y, result.getPoint().y, 0); @@ -553,10 +548,19 @@ public void ConvertToWeightedLatLngReturnsCorrectData() { @Test() public void ConvertToWeightedDataReturnsCorrectData() { final double intensity = 3.3; - final List data = List.of(List.of(List.of(1.1, 2.2), intensity)); + final List data = + List.of( + new Messages.PlatformWeightedLatLng.Builder() + .setPoint( + new Messages.PlatformLatLng.Builder() + .setLatitude(1.1) + .setLongitude(2.2) + .build()) + .setWeight(intensity) + .build()); final Point point = sProjection.toPoint(new LatLng(1.1, 2.2)); - final List result = Convert.toWeightedData(data); + final List result = Convert.weightedDataFromPigeon(data); Assert.assertEquals(1, result.size()); Assert.assertEquals(point.x, result.get(0).getPoint().x, 0); @@ -566,22 +570,25 @@ public void ConvertToWeightedDataReturnsCorrectData() { @Test() public void ConvertToGradientReturnsCorrectData() { - final int color1 = 0; - final int color2 = 1; - final int color3 = 2; - final List colorData = List.of(color1, color2, color3); + final long color1 = 0; + final long color2 = 1; + final long color3 = 2; + final List colorData = + List.of( + createPlatformColor(color1), createPlatformColor(color2), createPlatformColor(color3)); final double startPoint1 = 0.0; final double startPoint2 = 1.0; final double startPoint3 = 2.0; - List startPointData = List.of(startPoint1, startPoint2, startPoint3); - final int colorMapSize = 3; - final Map data = - Map.of( - HEATMAP_GRADIENT_COLORS_KEY, colorData, - HEATMAP_GRADIENT_START_POINTS_KEY, startPointData, - HEATMAP_GRADIENT_COLOR_MAP_SIZE_KEY, colorMapSize); + List startPointData = List.of(startPoint1, startPoint2, startPoint3); + final long colorMapSize = 3; + final Messages.PlatformHeatmapGradient data = + new Messages.PlatformHeatmapGradient.Builder() + .setColors(colorData) + .setStartPoints(startPointData) + .setColorMapSize(colorMapSize) + .build(); - final Gradient result = Convert.toGradient(data); + final Gradient result = Convert.gradientFromPigeon(data); Assert.assertEquals(3, result.getColors().length); Assert.assertEquals(color1, result.getColors()[0]); @@ -597,43 +604,50 @@ public void ConvertToGradientReturnsCorrectData() { @Test() public void ConvertInterpretHeatmapOptionsReturnsCorrectData() { final double intensity = 3.3; - final List dataData = List.of(List.of(List.of(1.1, 2.2), intensity)); + final List dataData = + List.of( + new Messages.PlatformWeightedLatLng.Builder() + .setPoint( + new Messages.PlatformLatLng.Builder() + .setLatitude(1.1) + .setLongitude(2.2) + .build()) + .setWeight(intensity) + .build()); final Point point = sProjection.toPoint(new LatLng(1.1, 2.2)); - final int color1 = 0; - final int color2 = 1; - final int color3 = 2; - final List colorData = List.of(color1, color2, color3); + final long color1 = 0; + final long color2 = 1; + final long color3 = 2; + final List colorData = + List.of( + createPlatformColor(color1), createPlatformColor(color2), createPlatformColor(color3)); final double startPoint1 = 0.0; final double startPoint2 = 1.0; final double startPoint3 = 2.0; - List startPointData = List.of(startPoint1, startPoint2, startPoint3); - final int colorMapSize = 3; - final Map gradientData = - Map.of( - HEATMAP_GRADIENT_COLORS_KEY, colorData, - HEATMAP_GRADIENT_START_POINTS_KEY, startPointData, - HEATMAP_GRADIENT_COLOR_MAP_SIZE_KEY, colorMapSize); - - final double maxIntensity = 4.4; + List startPointData = List.of(startPoint1, startPoint2, startPoint3); + final long colorMapSize = 3; + final Messages.PlatformHeatmapGradient gradientData = + new Messages.PlatformHeatmapGradient.Builder() + .setColors(colorData) + .setStartPoints(startPointData) + .setColorMapSize(colorMapSize) + .build(); + + final double maxIntensity = 4.0; final double opacity = 5.5; - final int radius = 6; + final long radius = 6; final String idData = "heatmap_1"; - final Map data = - Map.of( - HEATMAP_DATA_KEY, - dataData, - HEATMAP_GRADIENT_KEY, - gradientData, - HEATMAP_MAX_INTENSITY_KEY, - maxIntensity, - HEATMAP_OPACITY_KEY, - opacity, - HEATMAP_RADIUS_KEY, - radius, - HEATMAP_ID_KEY, - idData); + final Messages.PlatformHeatmap data = + new Messages.PlatformHeatmap.Builder() + .setData(dataData) + .setGradient(gradientData) + .setMaxIntensity(maxIntensity) + .setOpacity(opacity) + .setRadius(radius) + .setHeatmapId(idData) + .build(); final MockHeatmapBuilder builder = new MockHeatmapBuilder(); final String id = Convert.interpretHeatmapOptions(data, builder); @@ -657,6 +671,10 @@ public void ConvertInterpretHeatmapOptionsReturnsCorrectData() { Assert.assertEquals(idData, id); } + private Messages.PlatformColor createPlatformColor(long rgba) { + return new Messages.PlatformColor.Builder().setArgbValue(rgba).build(); + } + @Test public void buildGroundOverlayAnchorForPigeonWithNonCrossingMeridian() { LatLng position = new LatLng(10, 20); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java index 0470ced583f5..c97293b2c13a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java @@ -4,10 +4,6 @@ package io.flutter.plugins.googlemaps; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_DATA_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_ID_KEY; -import static io.flutter.plugins.googlemaps.Convert.HEATMAP_OPACITY_KEY; -import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -19,11 +15,8 @@ import com.google.android.gms.maps.model.TileOverlay; import com.google.android.gms.maps.model.TileOverlayOptions; import com.google.maps.android.heatmaps.HeatmapTileProvider; -import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -42,58 +35,57 @@ public void setUp() { controller.setGoogleMap(googleMap); } - @Test(expected = IllegalArgumentException.class) - public void controller_AddHeatmapThrowsErrorIfHeatmapIdIsNull() { - final Map heatmapOptions = new HashMap<>(); - - final List heatmaps = - Collections.singletonList( - new Messages.PlatformHeatmap.Builder().setJson(heatmapOptions).build()); - try { - controller.addHeatmaps(heatmaps); - } catch (IllegalArgumentException e) { - assertEquals("heatmapId was null", e.getMessage()); - throw e; - } - } - @Test public void controller_AddChangeAndRemoveHeatmap() { final TileOverlay tileOverlay = mock(TileOverlay.class); final HeatmapTileProvider heatmap = mock(HeatmapTileProvider.class); final String googleHeatmapId = "abc123"; - final Object heatmapData = - Collections.singletonList(Arrays.asList(Arrays.asList(1.1, 2.2), 3.3)); + final List heatmapData = + List.of( + new Messages.PlatformWeightedLatLng.Builder() + .setPoint( + new Messages.PlatformLatLng.Builder() + .setLatitude(1.1) + .setLongitude(2.2) + .build()) + .setWeight(3.3) + .build()); + final long radius = 20; when(googleMap.addTileOverlay(any(TileOverlayOptions.class))).thenReturn(tileOverlay); doReturn(heatmap).when(controller).buildHeatmap(any(HeatmapBuilder.class)); - final Map heatmapOptions1 = new HashMap<>(); - heatmapOptions1.put(HEATMAP_ID_KEY, googleHeatmapId); - heatmapOptions1.put(HEATMAP_DATA_KEY, heatmapData); + final double opacity1 = 0.1f; + final Messages.PlatformHeatmap heatmapOptions1 = + new Messages.PlatformHeatmap.Builder() + .setHeatmapId(googleHeatmapId) + .setData(heatmapData) + .setOpacity(opacity1) + .setRadius(radius) + .build(); - final List heatmaps = - Collections.singletonList( - new Messages.PlatformHeatmap.Builder().setJson(heatmapOptions1).build()); + final List heatmaps = Collections.singletonList(heatmapOptions1); controller.addHeatmaps(heatmaps); Mockito.verify(googleMap, times(1)) .addTileOverlay( Mockito.argThat(argument -> argument.getTileProvider() instanceof HeatmapTileProvider)); - final float opacity = 0.1f; - final Map heatmapOptions2 = new HashMap<>(); - heatmapOptions2.put(HEATMAP_ID_KEY, googleHeatmapId); - heatmapOptions2.put(HEATMAP_DATA_KEY, heatmapData); - heatmapOptions2.put(HEATMAP_OPACITY_KEY, opacity); + final double opacity2 = 0.2f; + final Messages.PlatformHeatmap heatmapOptions2 = + new Messages.PlatformHeatmap.Builder() + .setHeatmapId(googleHeatmapId) + .setData(heatmapData) + .setOpacity(opacity2) + .setRadius(radius) + .build(); final List heatmapUpdates = - Collections.singletonList( - new Messages.PlatformHeatmap.Builder().setJson(heatmapOptions2).build()); + Collections.singletonList(heatmapOptions2); controller.changeHeatmaps(heatmapUpdates); - Mockito.verify(heatmap, times(1)).setOpacity(opacity); + Mockito.verify(heatmap, times(1)).setOpacity(opacity2); controller.removeHeatmaps(Collections.singletonList(googleHeatmapId)); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart index 5d77d736f461..b371e7a3a1f6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart @@ -14,7 +14,6 @@ import 'package:stream_transform/stream_transform.dart'; import 'google_map_inspector_android.dart'; import 'messages.g.dart'; -import 'serialization.dart'; /// The non-test implementation of `_apiProvider`. MapsApi _productionApiProvider(int mapId) { @@ -779,7 +778,37 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { } static PlatformHeatmap _platformHeatmapFromHeatmap(Heatmap heatmap) { - return PlatformHeatmap(json: serializeHeatmap(heatmap)); + final HeatmapGradient? gradient = heatmap.gradient; + return PlatformHeatmap( + heatmapId: heatmap.heatmapId.value, + data: heatmap.data + .map(_platformWeightedLatLngFromWeightedLatLng) + .toList(), + gradient: _platformHeatmapGradientFromHeatmapGradient(gradient), + opacity: heatmap.opacity, + radius: heatmap.radius.radius, + maxIntensity: heatmap.maxIntensity, + ); + } + + static PlatformHeatmapGradient? _platformHeatmapGradientFromHeatmapGradient( + HeatmapGradient? gradient, + ) { + if (gradient == null) { + return null; + } + return PlatformHeatmapGradient( + colors: gradient.colors + .map( + (HeatmapGradientColor c) => + PlatformColor(argbValue: c.color.toARGB32()), + ) + .toList(), + startPoints: gradient.colors + .map((HeatmapGradientColor c) => c.startPoint) + .toList(), + colorMapSize: gradient.colorMapSize, + ); } static PlatformClusterManager _platformClusterManagerFromClusterManager( @@ -1286,6 +1315,15 @@ PlatformLatLngBounds? _platformLatLngBoundsFromLatLngBounds( ); } +PlatformWeightedLatLng _platformWeightedLatLngFromWeightedLatLng( + WeightedLatLng weightedLatLng, +) { + return PlatformWeightedLatLng( + point: _platformLatLngFromLatLng(weightedLatLng.point), + weight: weightedLatLng.weight, + ); +} + PlatformCameraTargetBounds? _platformCameraTargetBoundsFromCameraTargetBounds( CameraTargetBounds? bounds, ) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart index 09f5bef55d6e..ba5674412009 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart @@ -1,9 +1,9 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. +// Autogenerated from Pigeon (v26.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -568,15 +568,29 @@ class PlatformCircle { /// Pigeon equivalent of the Heatmap class. class PlatformHeatmap { - PlatformHeatmap({required this.json}); + PlatformHeatmap({ + required this.heatmapId, + required this.data, + this.gradient, + required this.opacity, + required this.radius, + this.maxIntensity, + }); + + String heatmapId; + + List data; + + PlatformHeatmapGradient? gradient; + + double opacity; - /// The heatmap data, as JSON. This should only be set from - /// Heatmap.toJson, and the native code must interpret it according to the - /// internal implementation details of that method. - Map json; + int radius; + + double? maxIntensity; List _toList() { - return [json]; + return [heatmapId, data, gradient, opacity, radius, maxIntensity]; } Object encode() { @@ -586,7 +600,12 @@ class PlatformHeatmap { static PlatformHeatmap decode(Object result) { result as List; return PlatformHeatmap( - json: (result[0] as Map?)!.cast(), + heatmapId: result[0]! as String, + data: (result[1] as List?)!.cast(), + gradient: result[2] as PlatformHeatmapGradient?, + opacity: result[3]! as double, + radius: result[4]! as int, + maxIntensity: result[5] as double?, ); } @@ -607,6 +626,99 @@ class PlatformHeatmap { int get hashCode => Object.hashAll(_toList()); } +/// Pigeon equivalent of the HeatmapGradient class. +/// +/// The Java Gradient structure is slightly different from HeatmapGradient, so +/// this matches the Android API so that conversion can be done on the Dart side +/// where the structures are easier to work with. +class PlatformHeatmapGradient { + PlatformHeatmapGradient({ + required this.colors, + required this.startPoints, + required this.colorMapSize, + }); + + List colors; + + List startPoints; + + int colorMapSize; + + List _toList() { + return [colors, startPoints, colorMapSize]; + } + + Object encode() { + return _toList(); + } + + static PlatformHeatmapGradient decode(Object result) { + result as List; + return PlatformHeatmapGradient( + colors: (result[0] as List?)!.cast(), + startPoints: (result[1] as List?)!.cast(), + colorMapSize: result[2]! as int, + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! PlatformHeatmapGradient || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + +/// Pigeon equivalent of the WeightedLatLng class. +class PlatformWeightedLatLng { + PlatformWeightedLatLng({required this.point, required this.weight}); + + PlatformLatLng point; + + double weight; + + List _toList() { + return [point, weight]; + } + + Object encode() { + return _toList(); + } + + static PlatformWeightedLatLng decode(Object result) { + result as List; + return PlatformWeightedLatLng( + point: result[0]! as PlatformLatLng, + weight: result[1]! as double, + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! PlatformWeightedLatLng || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + /// Pigeon equivalent of the ClusterManager class. class PlatformClusterManager { PlatformClusterManager({required this.identifier}); @@ -2327,93 +2439,99 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformHeatmap) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is PlatformClusterManager) { + } else if (value is PlatformHeatmapGradient) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PlatformDoublePair) { + } else if (value is PlatformWeightedLatLng) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformColor) { + } else if (value is PlatformClusterManager) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is PlatformInfoWindow) { + } else if (value is PlatformDoublePair) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is PlatformMarker) { + } else if (value is PlatformColor) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is PlatformPolygon) { + } else if (value is PlatformInfoWindow) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is PlatformPolyline) { + } else if (value is PlatformMarker) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is PlatformCap) { + } else if (value is PlatformPolygon) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is PlatformPatternItem) { + } else if (value is PlatformPolyline) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is PlatformTile) { + } else if (value is PlatformCap) { buffer.putUint8(156); writeValue(buffer, value.encode()); - } else if (value is PlatformTileOverlay) { + } else if (value is PlatformPatternItem) { buffer.putUint8(157); writeValue(buffer, value.encode()); - } else if (value is PlatformEdgeInsets) { + } else if (value is PlatformTile) { buffer.putUint8(158); writeValue(buffer, value.encode()); - } else if (value is PlatformLatLng) { + } else if (value is PlatformTileOverlay) { buffer.putUint8(159); writeValue(buffer, value.encode()); - } else if (value is PlatformLatLngBounds) { + } else if (value is PlatformEdgeInsets) { buffer.putUint8(160); writeValue(buffer, value.encode()); - } else if (value is PlatformCluster) { + } else if (value is PlatformLatLng) { buffer.putUint8(161); writeValue(buffer, value.encode()); - } else if (value is PlatformGroundOverlay) { + } else if (value is PlatformLatLngBounds) { buffer.putUint8(162); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraTargetBounds) { + } else if (value is PlatformCluster) { buffer.putUint8(163); writeValue(buffer, value.encode()); - } else if (value is PlatformMapViewCreationParams) { + } else if (value is PlatformGroundOverlay) { buffer.putUint8(164); writeValue(buffer, value.encode()); - } else if (value is PlatformMapConfiguration) { + } else if (value is PlatformCameraTargetBounds) { buffer.putUint8(165); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformMapViewCreationParams) { buffer.putUint8(166); writeValue(buffer, value.encode()); - } else if (value is PlatformTileLayer) { + } else if (value is PlatformMapConfiguration) { buffer.putUint8(167); writeValue(buffer, value.encode()); - } else if (value is PlatformZoomRange) { + } else if (value is PlatformPoint) { buffer.putUint8(168); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmap) { + } else if (value is PlatformTileLayer) { buffer.putUint8(169); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapDefaultMarker) { + } else if (value is PlatformZoomRange) { buffer.putUint8(170); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytes) { + } else if (value is PlatformBitmap) { buffer.putUint8(171); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAsset) { + } else if (value is PlatformBitmapDefaultMarker) { buffer.putUint8(172); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetImage) { + } else if (value is PlatformBitmapBytes) { buffer.putUint8(173); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetMap) { + } else if (value is PlatformBitmapAsset) { buffer.putUint8(174); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytesMap) { + } else if (value is PlatformBitmapAssetImage) { buffer.putUint8(175); writeValue(buffer, value.encode()); + } else if (value is PlatformBitmapAssetMap) { + buffer.putUint8(176); + writeValue(buffer, value.encode()); + } else if (value is PlatformBitmapBytesMap) { + buffer.putUint8(177); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -2423,22 +2541,22 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformMapType.values[value]; case 130: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformRendererType.values[value]; case 131: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformJointType.values[value]; case 132: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformCapType.values[value]; case 133: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformPatternItemType.values[value]; case 134: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformMapBitmapScaling.values[value]; case 135: return PlatformCameraPosition.decode(readValue(buffer)!); @@ -2465,62 +2583,66 @@ class _PigeonCodec extends StandardMessageCodec { case 146: return PlatformHeatmap.decode(readValue(buffer)!); case 147: - return PlatformClusterManager.decode(readValue(buffer)!); + return PlatformHeatmapGradient.decode(readValue(buffer)!); case 148: - return PlatformDoublePair.decode(readValue(buffer)!); + return PlatformWeightedLatLng.decode(readValue(buffer)!); case 149: - return PlatformColor.decode(readValue(buffer)!); + return PlatformClusterManager.decode(readValue(buffer)!); case 150: - return PlatformInfoWindow.decode(readValue(buffer)!); + return PlatformDoublePair.decode(readValue(buffer)!); case 151: - return PlatformMarker.decode(readValue(buffer)!); + return PlatformColor.decode(readValue(buffer)!); case 152: - return PlatformPolygon.decode(readValue(buffer)!); + return PlatformInfoWindow.decode(readValue(buffer)!); case 153: - return PlatformPolyline.decode(readValue(buffer)!); + return PlatformMarker.decode(readValue(buffer)!); case 154: - return PlatformCap.decode(readValue(buffer)!); + return PlatformPolygon.decode(readValue(buffer)!); case 155: - return PlatformPatternItem.decode(readValue(buffer)!); + return PlatformPolyline.decode(readValue(buffer)!); case 156: - return PlatformTile.decode(readValue(buffer)!); + return PlatformCap.decode(readValue(buffer)!); case 157: - return PlatformTileOverlay.decode(readValue(buffer)!); + return PlatformPatternItem.decode(readValue(buffer)!); case 158: - return PlatformEdgeInsets.decode(readValue(buffer)!); + return PlatformTile.decode(readValue(buffer)!); case 159: - return PlatformLatLng.decode(readValue(buffer)!); + return PlatformTileOverlay.decode(readValue(buffer)!); case 160: - return PlatformLatLngBounds.decode(readValue(buffer)!); + return PlatformEdgeInsets.decode(readValue(buffer)!); case 161: - return PlatformCluster.decode(readValue(buffer)!); + return PlatformLatLng.decode(readValue(buffer)!); case 162: - return PlatformGroundOverlay.decode(readValue(buffer)!); + return PlatformLatLngBounds.decode(readValue(buffer)!); case 163: - return PlatformCameraTargetBounds.decode(readValue(buffer)!); + return PlatformCluster.decode(readValue(buffer)!); case 164: - return PlatformMapViewCreationParams.decode(readValue(buffer)!); + return PlatformGroundOverlay.decode(readValue(buffer)!); case 165: - return PlatformMapConfiguration.decode(readValue(buffer)!); + return PlatformCameraTargetBounds.decode(readValue(buffer)!); case 166: - return PlatformPoint.decode(readValue(buffer)!); + return PlatformMapViewCreationParams.decode(readValue(buffer)!); case 167: - return PlatformTileLayer.decode(readValue(buffer)!); + return PlatformMapConfiguration.decode(readValue(buffer)!); case 168: - return PlatformZoomRange.decode(readValue(buffer)!); + return PlatformPoint.decode(readValue(buffer)!); case 169: - return PlatformBitmap.decode(readValue(buffer)!); + return PlatformTileLayer.decode(readValue(buffer)!); case 170: - return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); + return PlatformZoomRange.decode(readValue(buffer)!); case 171: - return PlatformBitmapBytes.decode(readValue(buffer)!); + return PlatformBitmap.decode(readValue(buffer)!); case 172: - return PlatformBitmapAsset.decode(readValue(buffer)!); + return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); case 173: - return PlatformBitmapAssetImage.decode(readValue(buffer)!); + return PlatformBitmapBytes.decode(readValue(buffer)!); case 174: - return PlatformBitmapAssetMap.decode(readValue(buffer)!); + return PlatformBitmapAsset.decode(readValue(buffer)!); case 175: + return PlatformBitmapAssetImage.decode(readValue(buffer)!); + case 176: + return PlatformBitmapAssetMap.decode(readValue(buffer)!); + case 177: return PlatformBitmapBytesMap.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2548,17 +2670,15 @@ class MapsApi { /// Returns once the map instance is available. Future waitForMap() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.waitForMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2579,19 +2699,17 @@ class MapsApi { Future updateMapConfiguration( PlatformMapConfiguration configuration, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateMapConfiguration$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [configuration], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2611,19 +2729,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateCircles$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2643,19 +2759,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateHeatmaps$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2674,19 +2788,17 @@ class MapsApi { List toAdd, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateClusterManagers$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2706,19 +2818,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateMarkers$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2738,19 +2848,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updatePolygons$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2770,19 +2878,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updatePolylines$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2802,19 +2908,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateTileOverlays$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2834,19 +2938,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateGroundOverlays$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2862,19 +2964,17 @@ class MapsApi { /// Gets the screen coordinate for the given map location. Future getScreenCoordinate(PlatformLatLng latLng) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getScreenCoordinate$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [latLng], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2895,19 +2995,17 @@ class MapsApi { /// Gets the map location for the given screen coordinate. Future getLatLng(PlatformPoint screenCoordinate) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getLatLng$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [screenCoordinate], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2928,17 +3026,15 @@ class MapsApi { /// Gets the map region currently displayed on the map. Future getVisibleRegion() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getVisibleRegion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2960,19 +3056,17 @@ class MapsApi { /// Moves the camera according to [cameraUpdate] immediately, with no /// animation. Future moveCamera(PlatformCameraUpdate cameraUpdate) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.moveCamera$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [cameraUpdate], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2992,19 +3086,17 @@ class MapsApi { PlatformCameraUpdate cameraUpdate, int? durationMilliseconds, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.animateCamera$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [cameraUpdate, durationMilliseconds], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3020,17 +3112,15 @@ class MapsApi { /// Gets the current map zoom level. Future getZoomLevel() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3051,19 +3141,17 @@ class MapsApi { /// Show the info window for the marker with the given ID. Future showInfoWindow(String markerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.showInfoWindow$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [markerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3079,19 +3167,17 @@ class MapsApi { /// Hide the info window for the marker with the given ID. Future hideInfoWindow(String markerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.hideInfoWindow$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [markerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3108,19 +3194,17 @@ class MapsApi { /// Returns true if the marker with the given ID is currently displaying its /// info window. Future isInfoWindowShown(String markerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.isInfoWindowShown$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [markerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3145,19 +3229,17 @@ class MapsApi { /// Returns false if there was an error setting the style, such as an invalid /// style string. Future setStyle(String style) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.setStyle$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [style], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3182,17 +3264,15 @@ class MapsApi { /// This allows checking asynchronously for initial style failures, as there /// is no way to return failures from map initialization. Future didLastStyleSucceed() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.didLastStyleSucceed$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3213,19 +3293,17 @@ class MapsApi { /// Clears the cache of tiles previously requseted from the tile provider. Future clearTileCache(String tileOverlayId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.clearTileCache$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [tileOverlayId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3241,17 +3319,15 @@ class MapsApi { /// Takes a snapshot of the map and returns its image data. Future takeSnapshot() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsApi.takeSnapshot$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3335,8 +3411,7 @@ abstract class MapsCallbackApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMoveStarted$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3359,8 +3434,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMove$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3394,8 +3468,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraIdle$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3418,8 +3491,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3452,8 +3524,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onLongPress$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3486,8 +3557,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3520,8 +3590,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragStart$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3559,8 +3628,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDrag$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3598,8 +3666,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragEnd$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3637,8 +3704,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onInfoWindowTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3671,8 +3737,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCircleTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3705,8 +3770,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onClusterTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3739,8 +3803,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolygonTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3773,8 +3836,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolylineTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3807,8 +3869,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onGroundOverlayTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3841,8 +3902,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.getTileOverlayTile$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3918,19 +3978,17 @@ class MapsInitializerApi { Future initializeWithPreferredRenderer( PlatformRendererType? type, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.initializeWithPreferredRenderer$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [type], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3952,17 +4010,15 @@ class MapsInitializerApi { /// Attempts to trigger any thread-blocking work /// the Google Maps SDK normally does when a map is shown for the first time. Future warmup() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.warmup$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3998,19 +4054,17 @@ class MapsPlatformViewApi { final String pigeonVar_messageChannelSuffix; Future createView(PlatformMapViewCreationParams? type) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsPlatformViewApi.createView$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [type], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4044,17 +4098,15 @@ class MapsInspectorApi { final String pigeonVar_messageChannelSuffix; Future areBuildingsEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areBuildingsEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4074,17 +4126,15 @@ class MapsInspectorApi { } Future areRotateGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areRotateGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4104,17 +4154,15 @@ class MapsInspectorApi { } Future areZoomControlsEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areZoomControlsEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4134,17 +4182,15 @@ class MapsInspectorApi { } Future areScrollGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areScrollGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4164,17 +4210,15 @@ class MapsInspectorApi { } Future areTiltGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areTiltGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4194,17 +4238,15 @@ class MapsInspectorApi { } Future areZoomGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areZoomGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4224,17 +4266,15 @@ class MapsInspectorApi { } Future isCompassEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isCompassEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4254,17 +4294,15 @@ class MapsInspectorApi { } Future isLiteModeEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isLiteModeEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4279,17 +4317,15 @@ class MapsInspectorApi { } Future isMapToolbarEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isMapToolbarEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4309,17 +4345,15 @@ class MapsInspectorApi { } Future isMyLocationButtonEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isMyLocationButtonEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4339,17 +4373,15 @@ class MapsInspectorApi { } Future isTrafficEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isTrafficEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4369,19 +4401,17 @@ class MapsInspectorApi { } Future getTileOverlayInfo(String tileOverlayId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getTileOverlayInfo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [tileOverlayId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4398,19 +4428,17 @@ class MapsInspectorApi { Future getGroundOverlayInfo( String groundOverlayId, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getGroundOverlayInfo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [groundOverlayId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4425,17 +4453,15 @@ class MapsInspectorApi { } Future getZoomRange() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getZoomRange$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4455,19 +4481,17 @@ class MapsInspectorApi { } Future> getClusters(String clusterManagerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getClusters$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [clusterManagerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4488,17 +4512,15 @@ class MapsInspectorApi { } Future getCameraPosition() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getCameraPosition$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart deleted file mode 100644 index 5dbd8315b2ff..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; - -// These constants must match the corresponding constants in Convert.java -const String _heatmapIdKey = 'heatmapId'; -const String _heatmapDataKey = 'data'; -const String _heatmapGradientKey = 'gradient'; -const String _heatmapMaxIntensityKey = 'maxIntensity'; -const String _heatmapOpacityKey = 'opacity'; -const String _heatmapRadiusKey = 'radius'; -const String _heatmapGradientColorsKey = 'colors'; -const String _heatmapGradientStartPointsKey = 'startPoints'; -const String _heatmapGradientColorMapSizeKey = 'colorMapSize'; - -void _addIfNonNull(Map map, String fieldName, Object? value) { - if (value != null) { - map[fieldName] = value; - } -} - -/// Serialize [Heatmap] -Map serializeHeatmap(Heatmap heatmap) { - final json = {}; - - _addIfNonNull(json, _heatmapIdKey, heatmap.heatmapId.value); - _addIfNonNull( - json, - _heatmapDataKey, - heatmap.data.map(serializeWeightedLatLng).toList(), - ); - - final HeatmapGradient? gradient = heatmap.gradient; - if (gradient != null) { - _addIfNonNull( - json, - _heatmapGradientKey, - serializeHeatmapGradient(gradient), - ); - } - _addIfNonNull(json, _heatmapMaxIntensityKey, heatmap.maxIntensity); - _addIfNonNull(json, _heatmapOpacityKey, heatmap.opacity); - _addIfNonNull(json, _heatmapRadiusKey, heatmap.radius.radius); - - return json; -} - -/// Serialize [WeightedLatLng] -Object serializeWeightedLatLng(WeightedLatLng wll) { - return [serializeLatLng(wll.point), wll.weight]; -} - -/// Deserialize [WeightedLatLng] -WeightedLatLng? deserializeWeightedLatLng(Object? json) { - if (json == null) { - return null; - } - assert(json is List && json.length == 2); - final list = json as List; - final LatLng latLng = deserializeLatLng(list[0])!; - return WeightedLatLng(latLng, weight: list[1] as double); -} - -/// Serialize [LatLng] -Object serializeLatLng(LatLng latLng) { - return [latLng.latitude, latLng.longitude]; -} - -/// Deserialize [LatLng] -LatLng? deserializeLatLng(Object? json) { - if (json == null) { - return null; - } - assert(json is List && json.length == 2); - final list = json as List; - return LatLng(list[0]! as double, list[1]! as double); -} - -/// Serialize [HeatmapGradient] -Object serializeHeatmapGradient(HeatmapGradient gradient) { - final json = {}; - - _addIfNonNull( - json, - _heatmapGradientColorsKey, - gradient.colors - .map((HeatmapGradientColor e) => e.color.toARGB32()) - .toList(), - ); - _addIfNonNull( - json, - _heatmapGradientStartPointsKey, - gradient.colors.map((HeatmapGradientColor e) => e.startPoint).toList(), - ); - _addIfNonNull(json, _heatmapGradientColorMapSizeKey, gradient.colorMapSize); - - return json; -} - -/// Deserialize [HeatmapGradient] -HeatmapGradient? deserializeHeatmapGradient(Object? json) { - if (json == null) { - return null; - } - assert(json is Map); - final Map map = (json as Map).cast(); - final List colors = (map[_heatmapGradientColorsKey]! as List) - .whereType() - .map((int e) => Color(e)) - .toList(); - final List startPoints = - (map[_heatmapGradientStartPointsKey]! as List) - .whereType() - .toList(); - final gradientColors = []; - for (var i = 0; i < colors.length; i++) { - gradientColors.add(HeatmapGradientColor(colors[i], startPoints[i])); - } - return HeatmapGradient( - gradientColors, - colorMapSize: map[_heatmapGradientColorMapSizeKey] as int? ?? 256, - ); -} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart index 1a31450f1889..60096d9cf3af 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart @@ -126,14 +126,46 @@ class PlatformCircle { /// Pigeon equivalent of the Heatmap class. class PlatformHeatmap { - PlatformHeatmap(this.json); - - /// The heatmap data, as JSON. This should only be set from - /// Heatmap.toJson, and the native code must interpret it according to the - /// internal implementation details of that method. - // TODO(stuartmorgan): Replace this with structured data. This exists only to - // allow incremental migration to Pigeon. - final Map json; + PlatformHeatmap({ + required this.heatmapId, + required this.data, + this.gradient, + required this.opacity, + required this.radius, + this.maxIntensity, + }); + + final String heatmapId; + final List data; + final PlatformHeatmapGradient? gradient; + final double opacity; + final int radius; + final double? maxIntensity; +} + +/// Pigeon equivalent of the HeatmapGradient class. +/// +/// The Java Gradient structure is slightly different from HeatmapGradient, so +/// this matches the Android API so that conversion can be done on the Dart side +/// where the structures are easier to work with. +class PlatformHeatmapGradient { + PlatformHeatmapGradient({ + required this.colors, + required this.startPoints, + required this.colorMapSize, + }); + + final List colors; + final List startPoints; + final int colorMapSize; +} + +/// Pigeon equivalent of the WeightedLatLng class. +class PlatformWeightedLatLng { + PlatformWeightedLatLng({required this.point, required this.weight}); + + final PlatformLatLng point; + final double weight; } /// Pigeon equivalent of the ClusterManager class. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index 9563058d4d2f..afea608e130b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.18.8 +version: 2.18.9 environment: sdk: ^3.9.0