[google_maps_flutter] Semi-convert remaining Android host API calls to Pigeon#6980
Conversation
| case "default": | ||
| initializeWithRendererRequest(null); | ||
| break; | ||
| default: |
There was a problem hiding this comment.
Is the default condition no longer possible?
There was a problem hiding this comment.
The special "default" value no longer exists, because requesting the default is now expressed as null in the Pigeon API, just as it already was at both the Dart API and Maps SDK API levels.
| "Renderer initialization called with invalid renderer type", | ||
| null); | ||
| initializationResult = null; | ||
| MapsInitializer.Renderer rendererType = null; |
There was a problem hiding this comment.
Nit: move this to a Convert.toMapRendererType
I will understand if you tell me this is overkill.
| initializationResult.error( | ||
| "Unknown renderer type", "Initialized with unknown renderer type", null); | ||
| new Messages.FlutterError( | ||
| "Unknown renderer type", "Initialized with unknown renderer type", null)); |
There was a problem hiding this comment.
I can see the argument for keeping this error the same but consider passing the type instead of null so that if we ever hit this condition we might be able to trace why the type was wrong.
There was a problem hiding this comment.
Added renderer.name() as the details; we don't like to change errors since it could break people, but adding data that just wasn't there is safe for any but the most contrived case.
| @@ -647,42 +1120,88 @@ private PigeonCodec() {} | |||
| protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { | |||
| switch (type) { | |||
| case (byte) 129: | |||
There was a problem hiding this comment.
Possibly for future work but consider either extracting these to named constants in this class or putting the byte as a static value on each of the class items then having a list of supported object types that all have a byte identifier and a read/write Value method.
Second pass note: Unless this is generated (which I don't think it is)
There was a problem hiding this comment.
This entire file is generated (see comment at the very top). In all other languages we make that clear with a .g. in the file name, but annoyingly Java doesn't allow that since the file name and the class name have to exactly match.
Does a "shallow" Pigeon conversion of the remaining host API calls in the Android implementation. All of the actual method calls are now Pigeon, but for the most part the data structures are not yet converted, and the Pigeon representations of the map objects are instead placeholders that currently just wrap the existing JSON serialization. This is done for a few reasons:
Future PRs will be able to incrementally convert each map object to a structured form. Converting the Flutter APIs (Java->Dart) will also be done in a follow-up, to limit the scope of this PR.
Adds Dart unit tests for each method call, as they were previously not unit tested.
Part of flutter/flutter#117907
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///).