[google_maps_flutter] Fix Circle update regression
Fixes a regression introduced in the last PR that did shallow Pigeon conversions of the maps calls, where the new Pigeon wrapper object was being passed directly to one of the not-yet-converted methods that was expecting the JSON data (i.e., circle.getJson() rather than circle). Also adds a native unit test exercising that codepath, which reproduced the cast error.
As a secondary step to improve safety is this hybrid state, for all of the map object controllers, I converted most of the methods taking Objects to taking Map<String, ?> instead, which is in practice what the JSON serialization of all of those objects is, and further pushed that through the Pigeon layer so that instead of casting throughout the Java code, the cast happens once on the Dart side. While the Dart cast is technically unsafe:
- It's the same level of unsafe as the previous situation, just centralized in a small amount of Dart code instead of spread through the Java code.
- In practice, the JSON serialization in the platform interface package, which is what this cast and all the previous Java code was making assumptions about, can never change, because it is a de-facto API surface. (The fact that we are relying on the JSON serialization code from what is now a different package was a mistake during federation, which has existing TODOs to fix; in practice the fix will almost certainly be to finish the Pigeon migration rather than to copy the JSON serialization.)
Part of https://github.com/flutter/flutter/issues/117907
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.) - [x] 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.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [x] I updated
CHANGELOG.mdto 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
///). - [x] 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.