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

Commit f31cb36

Browse files
duzenkoiskakaushik
authored andcommitted
[google_maps_flutter] Allow (de-)serialization of CameraPosition (#1784)
* Allow (de-)serialization of CameraPosition * Camera position toMap use fixes * Updated the pubspec and changelog
1 parent 05c2505 commit f31cb36

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

packages/google_maps_flutter/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.20+5
2+
3+
* Allow (de-)serialization of CameraPosition
4+
15
## 0.5.20+4
26

37
* Marker drag event

packages/google_maps_flutter/lib/src/camera.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ class CameraPosition {
5151
/// will be silently clamped to the supported range.
5252
final double zoom;
5353

54-
dynamic _toMap() => <String, dynamic>{
54+
dynamic toMap() => <String, dynamic>{
5555
'bearing': bearing,
5656
'target': target._toJson(),
5757
'tilt': tilt,
5858
'zoom': zoom,
5959
};
6060

61-
@visibleForTesting
6261
static CameraPosition fromMap(dynamic json) {
6362
if (json == null) {
6463
return null;
@@ -98,7 +97,7 @@ class CameraUpdate {
9897
/// Returns a camera update that moves the camera to the specified position.
9998
static CameraUpdate newCameraPosition(CameraPosition cameraPosition) {
10099
return CameraUpdate._(
101-
<dynamic>['newCameraPosition', cameraPosition._toMap()],
100+
<dynamic>['newCameraPosition', cameraPosition.toMap()],
102101
);
103102
}
104103

packages/google_maps_flutter/lib/src/google_map.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class _GoogleMapState extends State<GoogleMap> {
192192
@override
193193
Widget build(BuildContext context) {
194194
final Map<String, dynamic> creationParams = <String, dynamic>{
195-
'initialCameraPosition': widget.initialCameraPosition?._toMap(),
195+
'initialCameraPosition': widget.initialCameraPosition?.toMap(),
196196
'options': _googleMapOptions.toMap(),
197197
'markersToAdd': _serializeMarkerSet(widget.markers),
198198
'polygonsToAdd': _serializePolygonSet(widget.polygons),

packages/google_maps_flutter/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_maps_flutter
22
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
33
author: Flutter Team <[email protected]>
44
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
5-
version: 0.5.20+4
5+
version: 0.5.20+5
66

77
dependencies:
88
flutter:

0 commit comments

Comments
 (0)