Skip to content

Commit 393ce9b

Browse files
[google_maps_flutter_platform_interface] Fix typo in CameraUpdateNewLatLngBounds.toJson (#7626)
Replace `newLatLngZoom` with `newLatLngBounds` as it should be. See #7596 (review) Part of flutter/flutter#152928 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] page, which explains my responsibilities. - [x] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use `dart format`.) - [ ] I signed the [CLA]. - [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. `[shared_preferences]` - [x] I [linked to at least one issue that this PR fixes] in the description above. - [x] I updated `pubspec.yaml` with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes]. - [x] I updated `CHANGELOG.md` to add a description of the change, [following repository CHANGELOG style], or this PR is [exempt from CHANGELOG changes]. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md [relevant style guides]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md#style [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md [linked to at least one issue that this PR fixes]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview [pub versioning philosophy]: https://dart.dev/tools/pub/versioning [exempt from version changes]: https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#version [following repository CHANGELOG style]: https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog-style [exempt from CHANGELOG changes]: https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changelog [test-exempt]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests
1 parent 4c18648 commit 393ce9b

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.9.2
2+
3+
* Corrects JSON tag for `CameraUpdateNewLatLngBounds`.
4+
15
## 2.9.1
26

37
* Splits CameraUpdate into dervied classes for different update cases.

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/camera.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class CameraUpdateNewLatLngBounds extends CameraUpdate {
251251
/// The amount of padding by which the view is inset.
252252
final double padding;
253253
@override
254-
Object toJson() => <Object>['newLatLngZoom', bounds.toJson(), padding];
254+
Object toJson() => <Object>['newLatLngBounds', bounds.toJson(), padding];
255255
}
256256

257257
/// Defines a camera move to new coordinates with a zoom level.

packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_maps_f
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 2.9.1
7+
version: 2.9.2
88

99
environment:
1010
sdk: ^3.3.0

packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/camera_test.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ void main() {
3030
expect(cameraUpdate.updateType, CameraUpdateType.newCameraPosition);
3131
cameraUpdate as CameraUpdateNewCameraPosition;
3232
expect(cameraUpdate.cameraPosition, cameraPosition);
33+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
34+
expect(jsonList[0], 'newCameraPosition');
3335
});
3436

3537
test('CameraUpdate.newLatLng', () {
@@ -39,6 +41,8 @@ void main() {
3941
expect(cameraUpdate.updateType, CameraUpdateType.newLatLng);
4042
cameraUpdate as CameraUpdateNewLatLng;
4143
expect(cameraUpdate.latLng, latLng);
44+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
45+
expect(jsonList[0], 'newLatLng');
4246
});
4347

4448
test('CameraUpdate.newLatLngBounds', () {
@@ -52,6 +56,8 @@ void main() {
5256
cameraUpdate as CameraUpdateNewLatLngBounds;
5357
expect(cameraUpdate.bounds, latLngBounds);
5458
expect(cameraUpdate.padding, padding);
59+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
60+
expect(jsonList[0], 'newLatLngBounds');
5561
});
5662

5763
test('CameraUpdate.newLatLngZoom', () {
@@ -63,6 +69,8 @@ void main() {
6369
cameraUpdate as CameraUpdateNewLatLngZoom;
6470
expect(cameraUpdate.latLng, latLng);
6571
expect(cameraUpdate.zoom, zoom);
72+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
73+
expect(jsonList[0], 'newLatLngZoom');
6674
});
6775

6876
test('CameraUpdate.scrollBy', () {
@@ -74,6 +82,8 @@ void main() {
7482
cameraUpdate as CameraUpdateScrollBy;
7583
expect(cameraUpdate.dx, dx);
7684
expect(cameraUpdate.dy, dy);
85+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
86+
expect(jsonList[0], 'scrollBy');
7787
});
7888

7989
test('CameraUpdate.zoomBy', () {
@@ -85,17 +95,23 @@ void main() {
8595
cameraUpdate as CameraUpdateZoomBy;
8696
expect(cameraUpdate.amount, amount);
8797
expect(cameraUpdate.focus, focus);
98+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
99+
expect(jsonList[0], 'zoomBy');
88100
});
89101

90102
test('CameraUpdate.zoomIn', () {
91103
final CameraUpdate cameraUpdate = CameraUpdate.zoomIn();
92104
expect(cameraUpdate.runtimeType, CameraUpdateZoomIn);
93105
expect(cameraUpdate.updateType, CameraUpdateType.zoomIn);
106+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
107+
expect(jsonList[0], 'zoomIn');
94108
});
95109

96110
test('CameraUpdate.zoomOut', () {
97111
final CameraUpdate cameraUpdate = CameraUpdate.zoomOut();
98112
expect(cameraUpdate.runtimeType, CameraUpdateZoomOut);
99113
expect(cameraUpdate.updateType, CameraUpdateType.zoomOut);
114+
final List<Object> jsonList = cameraUpdate.toJson() as List<Object>;
115+
expect(jsonList[0], 'zoomOut');
100116
});
101117
}

0 commit comments

Comments
 (0)