Skip to content

Commit f116dd2

Browse files
[google_maps_flutter] Partial Android host API Pigeon conversion (flutter#6967)
Converts the host API methods other than the various map-object-update methods to Pigeon, as a starting point for a Pigeon conversion. This introduces the Pigeon structure for the main APIs, without getting into complex object serialization. Future work includes: - Converting the update methods. - Converting the calls from native to Dart (Flutter API in Pigeon terms). Also replaces the very minimal Dart unit tests with full tests of all the new methods. Part of flutter#117907
1 parent 8966342 commit f116dd2

File tree

12 files changed

+1613
-301
lines changed

12 files changed

+1613
-301
lines changed

packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.10.0
2+
3+
* Converts some platform calls to Pigeon.
4+
15
## 2.9.1
26

37
* Converts inspector interface platform calls to Pigeon.

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,15 @@ static Object latLngToJson(LatLng latLng) {
439439

440440
static Messages.PlatformLatLng latLngToPigeon(LatLng latLng) {
441441
return new Messages.PlatformLatLng.Builder()
442-
.setLat(latLng.latitude)
443-
.setLng(latLng.longitude)
442+
.setLatitude(latLng.latitude)
443+
.setLongitude(latLng.longitude)
444444
.build();
445445
}
446446

447+
static LatLng latLngFromPigeon(Messages.PlatformLatLng latLng) {
448+
return new LatLng(latLng.getLatitude(), latLng.getLongitude());
449+
}
450+
447451
static Object clusterToJson(String clusterManagerId, Cluster<MarkerBuilder> cluster) {
448452
int clusterSize = cluster.getSize();
449453
LatLngBounds.Builder latLngBoundsBuilder = LatLngBounds.builder();
@@ -500,17 +504,12 @@ static LatLng toLatLng(Object o) {
500504
return new LatLng(toDouble(data.get(0)), toDouble(data.get(1)));
501505
}
502506

503-
static Point toPoint(Object o) {
504-
Object x = toMap(o).get("x");
505-
Object y = toMap(o).get("y");
506-
return new Point((int) x, (int) y);
507+
static Point pointFromPigeon(Messages.PlatformPoint point) {
508+
return new Point(point.getX().intValue(), point.getY().intValue());
507509
}
508510

509-
static Map<String, Integer> pointToJson(Point point) {
510-
final Map<String, Integer> data = new HashMap<>(2);
511-
data.put("x", point.x);
512-
data.put("y", point.y);
513-
return data;
511+
static Messages.PlatformPoint pointToPigeon(Point point) {
512+
return new Messages.PlatformPoint.Builder().setX((long) point.x).setY((long) point.y).build();
514513
}
515514

516515
private static LatLngBounds toLatLngBounds(Object o) {

0 commit comments

Comments
 (0)