diff --git a/.ci.yaml b/.ci.yaml index 37590f9c73b0..ffb6f2004001 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -95,12 +95,12 @@ platform_properties: [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] - os: Mac-15.5|Mac-15.7 + os: Mac-15.7 device_type: none cpu: arm64 $flutter/osx_sdk : >- { - "sdk_version": "16c5032a" + "sdk_version": "17c52" } mac_x64: properties: @@ -108,12 +108,12 @@ platform_properties: [ {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] - os: Mac-15.5|Mac-15.7 + os: Mac-15.7 device_type: none cpu: x86 $flutter/osx_sdk : >- { - "sdk_version": "16c5032a" + "sdk_version": "17c52" } targets: diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index 59d0f6d9a647..c74e24fe60a9 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -bf18e3958a05cd8cc098d4bfcbe9163d596cf3af +8e8a194923dc579beb7fe83b363903e30d79243c diff --git a/.ci/flutter_stable.version b/.ci/flutter_stable.version index cab742975b85..7a8094729143 100644 --- a/.ci/flutter_stable.version +++ b/.ci/flutter_stable.version @@ -1 +1 @@ -db50e20168db8fee486b9abf32fc912de3bc5b6a +cc0734ac716fbb8b90f3f9db8020958b1553afa7 diff --git a/.ci/legacy_project/README.md b/.ci/legacy_project/README.md index ea3b4faaaba1..106274fe66f9 100644 --- a/.ci/legacy_project/README.md +++ b/.ci/legacy_project/README.md @@ -52,7 +52,7 @@ and then deleting everything but `android/` from it: imperative apply (this includes moving where the Android Gradle Plugin (AGP) version is set from `build.gradle` to `settings.gradle`). - Modifies `settings.gradle` to upgrade the Kotlin Gradle Plugin (KGP) - from version 1.9.0 to 2.1.0. If a user runs into an error with the AGP version, + from version 1.9.0 to 2.2.20. If a user runs into an error with the AGP version, the warning is clear on how to upgrade the version to one that we support. - Modifies `gradle.properties` to not set android.enableJetifier=true. - Update `app/build.gradle` to enable library desugaring to support diff --git a/.ci/legacy_project/all_packages/android/settings.gradle b/.ci/legacy_project/all_packages/android/settings.gradle index 400520e3df9a..adf202221a5d 100644 --- a/.ci/legacy_project/all_packages/android/settings.gradle +++ b/.ci/legacy_project/all_packages/android/settings.gradle @@ -20,7 +20,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.9.1" apply false - id "org.jetbrains.kotlin.android" version "2.1.0" apply false + id "org.jetbrains.kotlin.android" version "2.2.20" apply false } include ":app" diff --git a/.ci/scripts/create_simulator.sh b/.ci/scripts/create_simulator.sh index a993f470f378..e43100266004 100755 --- a/.ci/scripts/create_simulator.sh +++ b/.ci/scripts/create_simulator.sh @@ -9,7 +9,7 @@ set -o pipefail # The name here must match remove_simulator.sh readonly DEVICE_NAME=Flutter-iPhone readonly DEVICE=com.apple.CoreSimulator.SimDeviceType.iPhone-14 -readonly OS=com.apple.CoreSimulator.SimRuntime.iOS-18-2 +readonly OS=com.apple.CoreSimulator.SimRuntime.iOS-26-2 # Delete any existing devices named Flutter-iPhone. Having more than one may # cause issues when builds target the device. diff --git a/.ci/targets/ios_platform_tests.yaml b/.ci/targets/ios_platform_tests.yaml index 4e10a6f091b7..2cad013b0404 100644 --- a/.ci/targets/ios_platform_tests.yaml +++ b/.ci/targets/ios_platform_tests.yaml @@ -26,7 +26,7 @@ tasks: - name: native test script: .ci/scripts/tool_runner.sh # Simulator name and version must match name and version in create_simulator.sh - args: ["native-test", "--ios", "--ios-destination", "platform=iOS Simulator,name=Flutter-iPhone,OS=18.2", "--xcode-warnings-exceptions=script/configs/xcode_warnings_exceptions.yaml"] + args: ["native-test", "--ios", "--ios-destination", "platform=iOS Simulator,name=Flutter-iPhone,OS=26.2", "--xcode-warnings-exceptions=script/configs/xcode_warnings_exceptions.yaml"] - name: boot simulator # Ensure simulator is still booted script: .ci/scripts/boot_simulator.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9b108e970a78..161fc727d94d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -125,15 +125,17 @@ updates: patterns: - "androidx.annotation:annotation" ignore: + - dependency-name: "androidx.test:*" + update-types: ["version-update:semver-patch"] - dependency-name: "com.android.tools.build:gradle" + update-types: ["version-update:semver-minor", "version-update:semver-patch"] + - dependency-name: "io.mockk:mockk:*" update-types: ["version-update:semver-patch"] - dependency-name: "junit:junit" update-types: ["version-update:semver-patch"] + - dependency-name: "org.jetbrains.kotlin:*" + update-types: ["version-update:semver-minor", "version-update:semver-patch"] - dependency-name: "org.mockito:*" update-types: ["version-update:semver-patch"] - - dependency-name: "androidx.test:*" - update-types: ["version-update:semver-patch"] - dependency-name: "org.robolectric:*" update-types: ["version-update:semver-patch"] - - dependency-name: "io.mockk:mockk:*" - update-types: ["version-update:semver-patch"] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ab14d6890c24..a045a9c5ec52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,7 +40,7 @@ jobs: # because there doesn't appear to be anything to wait for. To avoid that, # explicitly wait for one LUCI test by name first. - name: Wait for test check-in - uses: lewagon/wait-on-check-action@a08fbe2b86f9336198f33be6ad9c16b96f92799c + uses: lewagon/wait-on-check-action@9312864dfbc9fd208e9c0417843430751c042800 with: ref: ${{ github.sha }} check-name: 'Linux ci_yaml packages roller' @@ -52,7 +52,7 @@ jobs: # This workflow should be the last to run. So wait for all the other tests to succeed. - name: Wait on all tests - uses: lewagon/wait-on-check-action@a08fbe2b86f9336198f33be6ad9c16b96f92799c + uses: lewagon/wait-on-check-action@9312864dfbc9fd208e9c0417843430751c042800 with: ref: ${{ github.sha }} running-workflow-name: 'release' diff --git a/.github/workflows/reusable_release.yml b/.github/workflows/reusable_release.yml index b4050aeb787a..8518b74a8144 100644 --- a/.github/workflows/reusable_release.yml +++ b/.github/workflows/reusable_release.yml @@ -43,7 +43,7 @@ jobs: # explicitly wait for one LUCI test by name first. - name: Wait for test check-in if: inputs.branch-name == 'main' - uses: lewagon/wait-on-check-action@a08fbe2b86f9336198f33be6ad9c16b96f92799c + uses: lewagon/wait-on-check-action@9312864dfbc9fd208e9c0417843430751c042800 with: ref: ${{ github.sha }} check-name: 'Linux ci_yaml packages roller' @@ -56,7 +56,7 @@ jobs: # This workflow should be the last to run. So wait for all the other tests to succeed. - name: Wait on all tests if: inputs.branch-name == 'main' - uses: lewagon/wait-on-check-action@a08fbe2b86f9336198f33be6ad9c16b96f92799c + uses: lewagon/wait-on-check-action@9312864dfbc9fd208e9c0417843430751c042800 with: ref: ${{ github.sha }} running-workflow-name: 'release' diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java index b4f89adef9a3..818151d754fe 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java @@ -107,8 +107,10 @@ class Camera private CameraProperties cameraProperties; private final CameraFeatureFactory cameraFeatureFactory; private final Activity activity; + /** A {@link CameraCaptureSession.CaptureCallback} that handles events related to JPEG capture. */ private final CameraCaptureCallback cameraCaptureCallback; + /** A {@link Handler} for running tasks in the background. */ Handler backgroundHandler; @@ -119,12 +121,15 @@ class Camera CameraCaptureSession captureSession; @VisibleForTesting ImageReader pictureImageReader; ImageStreamReader imageStreamReader; + /** {@link CaptureRequest.Builder} for the camera preview */ CaptureRequest.Builder previewRequestBuilder; @VisibleForTesting MediaRecorder mediaRecorder; + /** True when recording video. */ boolean recordingVideo; + /** True when the preview is paused. */ @VisibleForTesting boolean pausedPreview; @@ -132,6 +137,7 @@ class Camera /** Holds the current capture timeouts */ private CaptureTimeoutsWrapper captureTimeouts; + /** Holds the last known capture properties */ private CameraCaptureProperties captureProps; @@ -271,8 +277,9 @@ private void prepareMediaRecorder(String outputFilePath) throws IOException { MediaRecorderBuilder mediaRecorderBuilder; - // TODO(camsim99): Revert changes that allow legacy code to be used when recordingProfile is null - // once this has largely been fixed on the Android side. https://github.com/flutter/flutter/issues/119668 + // TODO(camsim99): Revert changes that allow legacy code to be used when recordingProfile + // is null once this has largely been fixed on the Android side. + // https://github.com/flutter/flutter/issues/119668 if (SdkCapabilityChecker.supportsEncoderProfiles() && getRecordingProfile() != null) { mediaRecorderBuilder = new MediaRecorderBuilder( @@ -1157,7 +1164,8 @@ public void resumePreview() { public void startPreview(@Nullable Runnable onSuccessCallback) throws CameraAccessException, InterruptedException { - // If recording is already in progress, the camera is being flipped, so send it through the VideoRenderer to keep the correct orientation. + // If recording is already in progress, the camera is being flipped, so send it through the + // VideoRenderer to keep the correct orientation. if (recordingVideo) { startPreviewWithVideoRendererStream(onSuccessCallback); } else { @@ -1379,7 +1387,8 @@ public void setDescriptionWhileRecording(CameraProperties properties) { "setDescriptionWhileRecordingFailed", "Device was not recording", null); } - // See VideoRenderer.java; support for this EGL extension is required to switch camera while recording. + // See VideoRenderer.java; support for this EGL extension is required to switch camera while + // recording. if (!SdkCapabilityChecker.supportsEglRecordableAndroid()) { throw new Messages.FlutterError( "setDescriptionWhileRecordingFailed", diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraApiImpl.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraApiImpl.java index a84c86516f37..b3b04d5309e5 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraApiImpl.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraApiImpl.java @@ -89,8 +89,9 @@ private Long instantiateCamera(String cameraName, Messages.PlatformMediaSettings @SuppressWarnings("ConstantConditions") private void handleException(Exception exception, Messages.Result result) { // The code below exactly preserves the format of the native exceptions generated by pre-Pigeon - // code. Since `camera` currently leaks the raw platform exceptions to clients, there may be client - // code that relies on specific string values here, so these should not be changed. See + // code. Since `camera` currently leaks the raw platform exceptions to clients, there may + // be client code that relies on specific string values here, so these should not be changed. + // See // https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#platform-exception-handling // for longer-term solutions to this. if (exception instanceof CameraAccessException) { @@ -102,8 +103,9 @@ private void handleException(Exception exception, Messages.Result result) private void handleException(Exception exception, Messages.VoidResult result) { // The code below exactly preserves the format of the native exceptions generated by pre-Pigeon - // code. Since `camera` currently leaks the raw platform exceptions to clients, there may be client - // code that relies on specific string values here, so these should not be changed. See + // code. Since `camera` currently leaks the raw platform exceptions to clients, there may + // be client code that relies on specific string values here, so these should not be changed. + // See // https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#platform-exception-handling // for longer-term solutions to this. if (exception instanceof CameraAccessException) { diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Messages.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Messages.java index f0c3f2ff146f..e61e0c48c199 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Messages.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Messages.java @@ -942,6 +942,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -950,6 +951,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -958,6 +960,7 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** * Handles calls from Dart to the native side. * @@ -967,81 +970,108 @@ public interface CameraApi { /** Returns the list of available cameras. */ @NonNull List getAvailableCameras(); + /** Creates a new camera with the given name and settings and returns its ID. */ void create( @NonNull String cameraName, @NonNull PlatformMediaSettings mediaSettings, @NonNull Result result); + /** Initializes the camera with the given ID for the given image format. */ void initialize(@NonNull PlatformImageFormatGroup imageFormat); + /** Disposes of the camera with the given ID. */ void dispose(); + /** Locks the camera with the given ID to the given orientation. */ void lockCaptureOrientation(@NonNull PlatformDeviceOrientation orientation); + /** Unlocks the orientation for the camera with the given ID. */ void unlockCaptureOrientation(); + /** Takes a picture on the camera with the given ID and returns a path to the resulting file. */ void takePicture(@NonNull Result result); + /** Starts recording a video on the camera with the given ID. */ void startVideoRecording(@NonNull Boolean enableStream); + /** * Ends video recording on the camera with the given ID and returns the path to the resulting * file. */ @NonNull String stopVideoRecording(); + /** Pauses video recording on the camera with the given ID. */ void pauseVideoRecording(); + /** Resumes previously paused video recording on the camera with the given ID. */ void resumeVideoRecording(); + /** Begins streaming frames from the camera. */ void startImageStream(); + /** Stops streaming frames from the camera. */ void stopImageStream(); + /** Sets the flash mode of the camera with the given ID. */ void setFlashMode(@NonNull PlatformFlashMode flashMode, @NonNull VoidResult result); + /** Sets the exposure mode of the camera with the given ID. */ void setExposureMode(@NonNull PlatformExposureMode exposureMode, @NonNull VoidResult result); + /** * Sets the exposure point of the camera with the given ID. * *

A null value resets to the default exposure point. */ void setExposurePoint(@Nullable PlatformPoint point, @NonNull VoidResult result); + /** Returns the minimum exposure offset of the camera with the given ID. */ @NonNull Double getMinExposureOffset(); + /** Returns the maximum exposure offset of the camera with the given ID. */ @NonNull Double getMaxExposureOffset(); + /** Returns the exposure step size of the camera with the given ID. */ @NonNull Double getExposureOffsetStepSize(); + /** * Sets the exposure offset of the camera with the given ID and returns the actual exposure * offset. */ void setExposureOffset(@NonNull Double offset, @NonNull Result result); + /** Sets the focus mode of the camera with the given ID. */ void setFocusMode(@NonNull PlatformFocusMode focusMode); + /** * Sets the focus point of the camera with the given ID. * *

A null value resets to the default focus point. */ void setFocusPoint(@Nullable PlatformPoint point, @NonNull VoidResult result); + /** Returns the maximum zoom level of the camera with the given ID. */ @NonNull Double getMaxZoomLevel(); + /** Returns the minimum zoom level of the camera with the given ID. */ @NonNull Double getMinZoomLevel(); + /** Sets the zoom level of the camera with the given ID. */ void setZoomLevel(@NonNull Double zoom, @NonNull VoidResult result); + /** Pauses streaming of preview frames. */ void pausePreview(); + /** Resumes previously paused streaming of preview frames. */ void resumePreview(); + /** * Changes the camera while recording video. * @@ -1053,6 +1083,7 @@ void create( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Sets up an instance of `CameraApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraApi api) { setUp(binaryMessenger, "", api); @@ -1780,6 +1811,7 @@ public void error(Throwable error) { } } } + /** * Handles calls from native side to Dart that are not camera-specific. * @@ -1803,6 +1835,7 @@ public CameraGlobalEventApi( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Called when the device's physical orientation changes. */ public void deviceOrientationChanged( @NonNull PlatformDeviceOrientation orientationArg, @NonNull VoidResult result) { @@ -1829,6 +1862,7 @@ public void deviceOrientationChanged( }); } } + /** * Handles device-specific calls from native side to Dart. * @@ -1852,6 +1886,7 @@ public CameraEventApi( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Called when the camera is initialized. */ public void initialized( @NonNull PlatformCameraState initialStateArg, @NonNull VoidResult result) { @@ -1876,6 +1911,7 @@ public void initialized( } }); } + /** Called when an error occurs in the camera. */ public void error(@NonNull String messageArg, @NonNull VoidResult result) { final String channelName = @@ -1899,6 +1935,7 @@ public void error(@NonNull String messageArg, @NonNull VoidResult result) { } }); } + /** Called when the camera closes. */ public void closed(@NonNull VoidResult result) { final String channelName = diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/SdkCapabilityChecker.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/SdkCapabilityChecker.java index a1a2a6e3608b..e183f8299bfe 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/SdkCapabilityChecker.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/SdkCapabilityChecker.java @@ -18,7 +18,8 @@ public class SdkCapabilityChecker { @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P) public static boolean supportsDistortionCorrection() { - // See https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES + // See + // https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES return SDK_VERSION >= Build.VERSION_CODES.P; } @@ -36,13 +37,15 @@ public static boolean supportsEncoderProfiles() { @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.P) public static boolean supportsSessionConfiguration() { - // See https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration + // See + // https://developer.android.com/reference/android/hardware/camera2/params/SessionConfiguration return SDK_VERSION >= Build.VERSION_CODES.P; } @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R) public static boolean supportsZoomRatio() { - // See https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_ZOOM_RATIO + // See + // https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_ZOOM_RATIO return SDK_VERSION >= Build.VERSION_CODES.R; } } diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/autofocus/AutoFocusFeature.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/autofocus/AutoFocusFeature.java index 55c291591e6b..ade73a36917b 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/autofocus/AutoFocusFeature.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/autofocus/AutoFocusFeature.java @@ -54,7 +54,8 @@ public boolean checkIsSupported() { final Float minFocus = cameraProperties.getLensInfoMinimumFocusDistance(); // Check if the focal length of the lens is fixed. If the minimum focus distance == 0, then the - // focal length is fixed. The minimum focus distance can be null on some devices: https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE + // focal length is fixed. The minimum focus distance can be null on some devices: + // https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE boolean isFixedLength = minFocus == null || minFocus == 0; return !isFixedLength diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/exposurepoint/ExposurePointFeature.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/exposurepoint/ExposurePointFeature.java index 21005ff785df..b41f47e61f08 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/exposurepoint/ExposurePointFeature.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/exposurepoint/ExposurePointFeature.java @@ -98,7 +98,9 @@ public void updateBuilder(@NonNull CaptureRequest.Builder requestBuilder) { private void buildExposureRectangle() { if (this.cameraBoundaries == null) { throw new AssertionError( - "The cameraBoundaries should be set (using `ExposurePointFeature.setCameraBoundaries(Size)`) before updating the exposure point."); + "The cameraBoundaries should be set (using" + + " `ExposurePointFeature.setCameraBoundaries(Size)`) before updating the exposure" + + " point."); } if (this.exposurePoint == null) { this.exposureRectangle = null; diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/focuspoint/FocusPointFeature.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/focuspoint/FocusPointFeature.java index 90384e70981b..5b0866104263 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/focuspoint/FocusPointFeature.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/focuspoint/FocusPointFeature.java @@ -86,7 +86,8 @@ public void updateBuilder(@NonNull CaptureRequest.Builder requestBuilder) { private void buildFocusRectangle() { if (this.cameraBoundaries == null) { throw new AssertionError( - "The cameraBoundaries should be set (using `FocusPointFeature.setCameraBoundaries(Size)`) before updating the focus point."); + "The cameraBoundaries should be set (using `FocusPointFeature.setCameraBoundaries(Size)`)" + + " before updating the focus point."); } if (this.focusPoint == null) { this.focusRectangle = null; diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java index 9cc243fa1505..e07587e5fd87 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/resolution/ResolutionFeature.java @@ -138,8 +138,10 @@ static Size computeBestPreviewSize(int cameraId, ResolutionPreset preset) } } - // TODO(camsim99): Suppression is currently safe because legacy code is used as a fallback for SDK < S. - // This should be removed when reverting that fallback behavior: https://github.com/flutter/flutter/issues/119668. + // TODO(camsim99): Suppression is currently safe because legacy code is used as a fallback for + // SDK < S. + // This should be removed when reverting that fallback behavior: + // https://github.com/flutter/flutter/issues/119668. CamcorderProfile profile = getBestAvailableCamcorderProfileForResolutionPresetLegacy(cameraId, preset); return new Size(profile.videoFrameWidth, profile.videoFrameHeight); @@ -165,7 +167,8 @@ public static CamcorderProfile getBestAvailableCamcorderProfileForResolutionPres int cameraId, @NonNull ResolutionPreset preset) { if (cameraId < 0) { throw new AssertionError( - "getBestAvailableCamcorderProfileForResolutionPreset can only be used with valid (>=0) camera identifiers."); + "getBestAvailableCamcorderProfileForResolutionPreset can only be used with valid (>=0)" + + " camera identifiers."); } switch (preset) { @@ -173,32 +176,32 @@ public static CamcorderProfile getBestAvailableCamcorderProfileForResolutionPres if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_HIGH)) { return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH); } - // fall through + // fall through case ultraHigh: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_2160P)) { return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_2160P); } - // fall through + // fall through case veryHigh: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_1080P)) { return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_1080P); } - // fall through + // fall through case high: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_720P)) { return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_720P); } - // fall through + // fall through case medium: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) { return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P); } - // fall through + // fall through case low: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_QVGA)) { return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_QVGA); } - // fall through + // fall through default: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_LOW)) { return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_LOW); @@ -218,7 +221,8 @@ public static EncoderProfiles getBestAvailableCamcorderProfileForResolutionPrese int cameraId, @NonNull ResolutionPreset preset) { if (cameraId < 0) { throw new AssertionError( - "getBestAvailableCamcorderProfileForResolutionPreset can only be used with valid (>=0) camera identifiers."); + "getBestAvailableCamcorderProfileForResolutionPreset can only be used with valid (>=0)" + + " camera identifiers."); } String cameraIdString = Integer.toString(cameraId); @@ -228,32 +232,32 @@ public static EncoderProfiles getBestAvailableCamcorderProfileForResolutionPrese if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_HIGH)) { return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_HIGH); } - // fall through + // fall through case ultraHigh: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_2160P)) { return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_2160P); } - // fall through + // fall through case veryHigh: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_1080P)) { return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_1080P); } - // fall through + // fall through case high: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_720P)) { return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_720P); } - // fall through + // fall through case medium: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) { return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_480P); } - // fall through + // fall through case low: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_QVGA)) { return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_QVGA); } - // fall through + // fall through default: if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_LOW)) { return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_LOW); diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/sensororientation/DeviceOrientationManager.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/sensororientation/DeviceOrientationManager.java index cedd2d458c91..4156c18d7209 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/sensororientation/DeviceOrientationManager.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/sensororientation/DeviceOrientationManager.java @@ -201,7 +201,9 @@ public int getVideoOrientation(@Nullable PlatformChannel.DeviceOrientation orien return (angle + sensorOrientation + 360) % 360; } - /** @return the last received UI orientation. */ + /** + * @return the last received UI orientation. + */ @Nullable public PlatformChannel.DeviceOrientation getLastUIOrientation() { return this.lastOrientation; diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/zoomlevel/ZoomLevelFeature.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/zoomlevel/ZoomLevelFeature.java index a6d51197412f..0d064bd3dbae 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/zoomlevel/ZoomLevelFeature.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/features/zoomlevel/ZoomLevelFeature.java @@ -36,7 +36,8 @@ public ZoomLevelFeature(@NonNull CameraProperties cameraProperties) { hasSupport = false; return; } - // On Android 11+ CONTROL_ZOOM_RATIO_RANGE should be use to get the zoom ratio directly as minimum zoom does not have to be 1.0f. + // On Android 11+ CONTROL_ZOOM_RATIO_RANGE should be use to get the zoom ratio directly as + // minimum zoom does not have to be 1.0f. if (SdkCapabilityChecker.supportsZoomRatio()) { minimumZoomLevel = cameraProperties.getScalerMinZoomRatio(); maximumZoomLevel = cameraProperties.getScalerMaxZoomRatio(); diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/media/MediaRecorderBuilder.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/media/MediaRecorderBuilder.java index 3062fa3c8066..521cb5f7835f 100644 --- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/media/MediaRecorderBuilder.java +++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/media/MediaRecorderBuilder.java @@ -97,7 +97,8 @@ public MediaRecorder build() throws IOException, NullPointerException, IndexOutO MediaRecorder mediaRecorder = recorderFactory.makeMediaRecorder(); // There's a fixed order that mediaRecorder expects. Only change these functions accordingly. - // You can find the specifics here: https://developer.android.com/reference/android/media/MediaRecorder. + // You can find the specifics here: + // https://developer.android.com/reference/android/media/MediaRecorder. if (enableAudio) mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE); diff --git a/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java b/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java index 9b2b4ffeec81..85e317cd0c0b 100644 --- a/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java +++ b/packages/camera/camera_android/android/src/test/java/io/flutter/plugins/camera/CameraTest.java @@ -1219,11 +1219,11 @@ public void startVideoRecording_shouldApplySettingsToMediaRecorder() final ResolutionPreset resolutionPreset = ResolutionPreset.high; final boolean enableAudio = true; - //region These parameters should be set in android MediaRecorder. + // region These parameters should be set in android MediaRecorder. final int fps = 15; final int videoBitrate = 200000; final int audioBitrate = 32000; - //endregion + // endregion when(mockCameraProperties.getCameraName()).thenReturn(cameraName); @@ -1303,7 +1303,7 @@ public void startVideoRecording_shouldApplySettingsToMediaRecorder() camera.startVideoRecording(null); - //region Check that FPS parameter affects AE range at which the camera captures frames. + // region Check that FPS parameter affects AE range at which the camera captures frames. assertEquals(camera.cameraFeatures.getFpsRange().getValue().getLower(), Integer.valueOf(fps)); assertEquals(camera.cameraFeatures.getFpsRange().getValue().getUpper(), Integer.valueOf(fps)); @@ -1312,15 +1312,15 @@ public void startVideoRecording_shouldApplySettingsToMediaRecorder() eq(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE), argThat( (Range range) -> range.getLower() == fps && range.getUpper() == fps)); - //endregion + // endregion final MediaRecorder recorder = camera.mediaRecorder; - //region Check that parameters affects movies, written by MediaRecorder. + // region Check that parameters affects movies, written by MediaRecorder. verify(recorder).setVideoFrameRate(fps); verify(recorder).setAudioEncodingBitRate(audioBitrate); verify(recorder).setVideoEncodingBitRate(videoBitrate); - //endregion + // endregion } } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraControlProxyApi.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraControlProxyApi.java index 633b99c2f300..a037297b1b58 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraControlProxyApi.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraControlProxyApi.java @@ -74,8 +74,9 @@ public void onSuccess(Void voidResult) { @Override public void onFailure(@NonNull Throwable t) { if (t instanceof CameraControl.OperationCanceledException) { - // Operation was canceled due to camera being closed or a new request was submitted, which - // is not actionable and should not block a new value from potentially being submitted. + // Operation was canceled due to camera being closed or a new request was + // submitted, which is not actionable and should not block a new value from + // potentially being submitted. ResultCompat.success(null, callback); return; } @@ -105,8 +106,9 @@ public void onSuccess(FocusMeteringResult focusMeteringResult) { @Override public void onFailure(@NonNull Throwable t) { if (t instanceof CameraControl.OperationCanceledException) { - // Operation was canceled due to camera being closed or a new request was submitted, which - // is not actionable and should not block a new value from potentially being submitted. + // Operation was canceled due to camera being closed or a new request was + // submitted, which is not actionable and should not block a new value from + // potentially being submitted. ResultCompat.success(null, callback); return; } @@ -158,8 +160,9 @@ public void onSuccess(Integer integerResult) { @Override public void onFailure(@NonNull Throwable t) { if (t instanceof CameraControl.OperationCanceledException) { - // Operation was canceled due to camera being closed or a new request was submitted, which - // is not actionable and should not block a new value from potentially being submitted. + // Operation was canceled due to camera being closed or a new request was + // submitted, which is not actionable and should not block a new value from + // potentially being submitted. ResultCompat.success(null, callback); return; } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java index 01296bbdd678..83d8573cf2a8 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java @@ -191,7 +191,8 @@ int getDefaultRotation() { // fallback and prevents crashes until a valid Activity is attached again. Log.w( "DeviceOrientationManager", - "Cannot get display: Activity may be null (destroyed or not yet attached) due to a race condition."); + "Cannot get display: Activity may be null (destroyed or not yet attached) due to a race" + + " condition."); return Surface.ROTATION_0; } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java index e282be75531d..62931dceea86 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java @@ -717,6 +717,7 @@ public interface Result { void error(@NonNull Throwable error); } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { /** @@ -730,6 +731,7 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `InstanceManagerHostApi` to handle messages through the * `binaryMessenger`. @@ -759,6 +761,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { @@ -768,6 +771,7 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ @@ -797,6 +801,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -810,6 +815,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by JavaObjectFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -824,6 +830,7 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraInfoHostApi { @@ -843,6 +850,7 @@ public interface CameraInfoHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. */ @@ -952,6 +960,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraInfoFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -965,6 +974,7 @@ public CameraInfoFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by CameraInfoFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -979,6 +989,7 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraSelectorHostApi { @@ -991,6 +1002,7 @@ public interface CameraSelectorHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `CameraSelectorHostApi` to handle messages through the * `binaryMessenger`. @@ -1052,6 +1064,7 @@ static void setup( } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraSelectorFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1065,6 +1078,7 @@ public CameraSelectorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by CameraSelectorFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1080,6 +1094,7 @@ public void create( channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ProcessCameraProviderHostApi { @@ -1105,6 +1120,7 @@ Long bindToLifecycle( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the * `binaryMessenger`. @@ -1283,6 +1299,7 @@ public void error(Throwable error) { } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ProcessCameraProviderFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1296,6 +1313,7 @@ public ProcessCameraProviderFlutterApi(@NonNull BinaryMessenger argBinaryMesseng public interface Reply { void reply(T reply); } + /** The codec used by ProcessCameraProviderFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1312,6 +1330,7 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraHostApi { @@ -1325,6 +1344,7 @@ public interface CameraHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** Sets up an instance of `CameraHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHostApi api) { { @@ -1378,6 +1398,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1391,6 +1412,7 @@ public CameraFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by CameraFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1445,6 +1467,7 @@ void requestCameraPermissions( static @NonNull MessageCodec getCodec() { return SystemServicesHostApiCodec.INSTANCE; } + /** * Sets up an instance of `SystemServicesHostApi` to handle messages through the * `binaryMessenger`. @@ -1510,6 +1533,7 @@ public void error(Throwable error) { } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class SystemServicesFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1523,6 +1547,7 @@ public SystemServicesFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by SystemServicesFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1539,6 +1564,7 @@ public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface DeviceOrientationManagerHostApi { @@ -1557,6 +1583,7 @@ void startListeningForDeviceOrientationChange( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the * `binaryMessenger`. @@ -1662,6 +1689,7 @@ static void setup( } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class DeviceOrientationManagerFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1675,6 +1703,7 @@ public DeviceOrientationManagerFlutterApi(@NonNull BinaryMessenger argBinaryMess public interface Reply { void reply(T reply); } + /** The codec used by DeviceOrientationManagerFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1742,6 +1771,7 @@ void create( static @NonNull MessageCodec getCodec() { return PreviewHostApiCodec.INSTANCE; } + /** Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHostApi api) { { @@ -1900,6 +1930,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface VideoCaptureHostApi { @@ -1915,6 +1946,7 @@ public interface VideoCaptureHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `VideoCaptureHostApi` to handle messages through the * `binaryMessenger`. @@ -1999,6 +2031,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class VideoCaptureFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2012,6 +2045,7 @@ public VideoCaptureFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by VideoCaptureFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -2026,6 +2060,7 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface RecorderHostApi { @@ -2048,6 +2083,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `RecorderHostApi` to handle messages through the `binaryMessenger`. */ @@ -2162,6 +2198,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class RecorderFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2175,6 +2212,7 @@ public RecorderFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by RecorderFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -2193,6 +2231,7 @@ public void create( channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PendingRecordingHostApi { @@ -2203,6 +2242,7 @@ public interface PendingRecordingHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `PendingRecordingHostApi` to handle messages through the * `binaryMessenger`. @@ -2276,6 +2316,7 @@ public PendingRecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by PendingRecordingFlutterApi. */ static @NonNull MessageCodec getCodec() { return PendingRecordingFlutterApiCodec.INSTANCE; @@ -2302,6 +2343,7 @@ public void onVideoRecordingEvent( channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface RecordingHostApi { @@ -2317,6 +2359,7 @@ public interface RecordingHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `RecordingHostApi` to handle messages through the `binaryMessenger`. */ @@ -2415,6 +2458,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class RecordingFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2428,6 +2472,7 @@ public RecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by RecordingFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -2442,6 +2487,7 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageCaptureHostApi { @@ -2461,6 +2507,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `ImageCaptureHostApi` to handle messages through the * `binaryMessenger`. @@ -2622,6 +2669,7 @@ void create( static @NonNull MessageCodec getCodec() { return ResolutionStrategyHostApiCodec.INSTANCE; } + /** * Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the * `binaryMessenger`. @@ -2658,6 +2706,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ResolutionSelectorHostApi { @@ -2671,6 +2720,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the * `binaryMessenger`. @@ -2715,6 +2765,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface AspectRatioStrategyHostApi { @@ -2725,6 +2776,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the * `binaryMessenger`. @@ -2805,6 +2857,7 @@ public CameraStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by CameraStateFlutterApi. */ static @NonNull MessageCodec getCodec() { return CameraStateFlutterApiCodec.INSTANCE; @@ -2863,6 +2916,7 @@ public ExposureStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by ExposureStateFlutterApi. */ static @NonNull MessageCodec getCodec() { return ExposureStateFlutterApiCodec.INSTANCE; @@ -2883,6 +2937,7 @@ public void create( channelReply -> callback.reply(null)); } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ZoomStateFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2896,6 +2951,7 @@ public ZoomStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by ZoomStateFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -2914,6 +2970,7 @@ public void create( channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageAnalysisHostApi { @@ -2932,6 +2989,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `ImageAnalysisHostApi` to handle messages through the * `binaryMessenger`. @@ -3049,6 +3107,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface AnalyzerHostApi { @@ -3058,6 +3117,7 @@ public interface AnalyzerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `AnalyzerHostApi` to handle messages through the `binaryMessenger`. */ @@ -3087,6 +3147,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AnalyzerHo } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ObserverHostApi { @@ -3096,6 +3157,7 @@ public interface ObserverHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `ObserverHostApi` to handle messages through the `binaryMessenger`. */ @@ -3125,6 +3187,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ObserverHo } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ObserverFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -3138,6 +3201,7 @@ public ObserverFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by ObserverFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -3155,6 +3219,7 @@ public void onChanged( channelReply -> callback.reply(null)); } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraStateErrorFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -3168,6 +3233,7 @@ public CameraStateErrorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by CameraStateErrorFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -3224,6 +3290,7 @@ public interface LiveDataHostApi { static @NonNull MessageCodec getCodec() { return LiveDataHostApiCodec.INSTANCE; } + /** * Sets up an instance of `LiveDataHostApi` to handle messages through the `binaryMessenger`. */ @@ -3345,6 +3412,7 @@ public LiveDataFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by LiveDataFlutterApi. */ static @NonNull MessageCodec getCodec() { return LiveDataFlutterApiCodec.INSTANCE; @@ -3362,6 +3430,7 @@ public void create( channelReply -> callback.reply(null)); } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class AnalyzerFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -3375,6 +3444,7 @@ public AnalyzerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by AnalyzerFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -3401,6 +3471,7 @@ public void analyze( channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageProxyHostApi { @@ -3413,6 +3484,7 @@ public interface ImageProxyHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `ImageProxyHostApi` to handle messages through the `binaryMessenger`. */ @@ -3466,6 +3538,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxy } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ImageProxyFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -3479,6 +3552,7 @@ public ImageProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by ImageProxyFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -3498,6 +3572,7 @@ public void create( channelReply -> callback.reply(null)); } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PlaneProxyFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -3511,6 +3586,7 @@ public PlaneProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by PlaneProxyFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -3578,6 +3654,7 @@ void create( static @NonNull MessageCodec getCodec() { return QualitySelectorHostApiCodec.INSTANCE; } + /** * Sets up an instance of `QualitySelectorHostApi` to handle messages through the * `binaryMessenger`. @@ -3645,6 +3722,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FallbackStrategyHostApi { @@ -3657,6 +3735,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `FallbackStrategyHostApi` to handle messages through the * `binaryMessenger`. @@ -3697,6 +3776,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraControlHostApi { @@ -3720,6 +3800,7 @@ void setExposureCompensationIndex( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `CameraControlHostApi` to handle messages through the * `binaryMessenger`. @@ -3900,6 +3981,7 @@ public void error(Throwable error) { } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraControlFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -3913,6 +3995,7 @@ public CameraControlFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { public interface Reply { void reply(T reply); } + /** The codec used by CameraControlFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -3967,6 +4050,7 @@ void create( static @NonNull MessageCodec getCodec() { return FocusMeteringActionHostApiCodec.INSTANCE; } + /** * Sets up an instance of `FocusMeteringActionHostApi` to handle messages through the * `binaryMessenger`. @@ -4006,6 +4090,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FocusMeteringResultHostApi { @@ -4016,6 +4101,7 @@ public interface FocusMeteringResultHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `FocusMeteringResultHostApi` to handle messages through the * `binaryMessenger`. @@ -4051,6 +4137,7 @@ static void setup( } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FocusMeteringResultFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -4064,6 +4151,7 @@ public FocusMeteringResultFlutterApi(@NonNull BinaryMessenger argBinaryMessenger public interface Reply { void reply(T reply); } + /** The codec used by FocusMeteringResultFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -4080,6 +4168,7 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface MeteringPointHostApi { @@ -4097,6 +4186,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `MeteringPointHostApi` to handle messages through the * `binaryMessenger`. @@ -4232,6 +4322,7 @@ public interface CaptureRequestOptionsHostApi { static @NonNull MessageCodec getCodec() { return CaptureRequestOptionsHostApiCodec.INSTANCE; } + /** * Sets up an instance of `CaptureRequestOptionsHostApi` to handle messages through the * `binaryMessenger`. @@ -4267,6 +4358,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface Camera2CameraControlHostApi { @@ -4281,6 +4373,7 @@ void addCaptureRequestOptions( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `Camera2CameraControlHostApi` to handle messages through the * `binaryMessenger`. @@ -4393,6 +4486,7 @@ void createWithOnePreferredSize( static @NonNull MessageCodec getCodec() { return ResolutionFilterHostApiCodec.INSTANCE; } + /** * Sets up an instance of `ResolutionFilterHostApi` to handle messages through the * `binaryMessenger`. @@ -4429,6 +4523,7 @@ static void setup( } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface Camera2CameraInfoHostApi { @@ -4448,6 +4543,7 @@ public interface Camera2CameraInfoHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + /** * Sets up an instance of `Camera2CameraInfoHostApi` to handle messages through the * `binaryMessenger`. @@ -4565,6 +4661,7 @@ static void setup( } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class Camera2CameraInfoFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -4578,6 +4675,7 @@ public Camera2CameraInfoFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) public interface Reply { void reply(T reply); } + /** The codec used by Camera2CameraInfoFlutterApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureProxyApi.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureProxyApi.java index 7bf6bd508a25..78ba586b2314 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureProxyApi.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureProxyApi.java @@ -156,9 +156,12 @@ String getImageCaptureExceptionDescription(int imageCaptureErrorCode) { case ImageCapture.ERROR_CAMERA_CLOSED: return "Image capture failed due to the camera being closed."; case ImageCapture.ERROR_INVALID_CAMERA: - return "The ImageCapture use case was bound to an invalid camera by the Flutter camera plugin. If you see this error, please file an issue if you cannot find one that already exists: https://github.com/flutter/flutter/issues/."; + return "The ImageCapture use case was bound to an invalid camera by the Flutter camera" + + " plugin. If you see this error, please file an issue if you cannot find one" + + " that already exists: https://github.com/flutter/flutter/issues/."; default: - return "An unknown error has occurred while attempting to take a picture. Check the logs for more details."; + return "An unknown error has occurred while attempting to take a picture. Check the logs" + + " for more details."; } } } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewProxyApi.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewProxyApi.java index 56919b5a1567..990ac0e71daa 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewProxyApi.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewProxyApi.java @@ -88,7 +88,8 @@ public void releaseSurfaceProvider(@NonNull Preview pigeonInstance) { return; } throw new IllegalStateException( - "releaseFlutterSurfaceTexture() cannot be called if the flutterSurfaceProducer for the camera preview has not yet been initialized."); + "releaseFlutterSurfaceTexture() cannot be called if the flutterSurfaceProducer for the" + + " camera preview has not yet been initialized."); } @Override @@ -98,7 +99,8 @@ public boolean surfaceProducerHandlesCropAndRotation(@NonNull Preview pigeonInst return surfaceProducer.handlesCropAndRotation(); } throw new IllegalStateException( - "surfaceProducerHandlesCropAndRotation() cannot be called if the flutterSurfaceProducer for the camera preview has not yet been initialized."); + "surfaceProducerHandlesCropAndRotation() cannot be called if the flutterSurfaceProducer for" + + " the camera preview has not yet been initialized."); } @Nullable diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoRecordEventListenerProxyApi.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoRecordEventListenerProxyApi.java index 320e18a76529..8bb1e9e6991c 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoRecordEventListenerProxyApi.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoRecordEventListenerProxyApi.java @@ -17,6 +17,7 @@ class VideoRecordEventListenerProxyApi extends PigeonApiVideoRecordEventListener VideoRecordEventListenerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { super(pigeonRegistrar); } + /** * Implementation of {@link VideoRecordEventListener} that passes arguments of callback methods to * Dart. diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index fb538d49fd98..fc4a7de9d71e 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,6 +1,7 @@ -## NEXT +## 2.13.0 * Updates minimum supported SDK version to Flutter 3.35/Dart 3.9. +* Adds `setJpegImageQuality` for controlling JPEG compression quality. ## 2.12.0 diff --git a/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart b/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart index 3652de5861d5..97c4107668f5 100644 --- a/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart +++ b/packages/camera/camera_platform_interface/lib/src/method_channel/method_channel_camera.dart @@ -518,6 +518,15 @@ class MethodChannelCamera extends CameraPlatform { }); } + @override + Future setJpegImageQuality(int cameraId, int quality) { + assert(quality >= 1 && quality <= 100); + return _channel.invokeMethod('setJpegImageQuality', { + 'cameraId': cameraId, + 'quality': quality, + }); + } + @override Widget buildPreview(int cameraId) { return Texture(textureId: cameraId); diff --git a/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart b/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart index 152437a73312..192bce8b0134 100644 --- a/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart +++ b/packages/camera/camera_platform_interface/lib/src/platform_interface/camera_platform.dart @@ -347,4 +347,12 @@ abstract class CameraPlatform extends PlatformInterface { Future setImageFileFormat(int cameraId, ImageFileFormat format) { throw UnimplementedError('setImageFileFormat() is not implemented.'); } + + /// Sets the JPEG compression quality for still image capture. + /// + /// This only applies to images captured in JPEG format. + /// The [quality] must be between 1 (lowest) and 100 (highest). + Future setJpegImageQuality(int cameraId, int quality) { + throw UnimplementedError('setJpegImageQuality() is not implemented.'); + } } diff --git a/packages/camera/camera_platform_interface/pubspec.yaml b/packages/camera/camera_platform_interface/pubspec.yaml index 3c2a1cbea685..8336114d1837 100644 --- a/packages/camera/camera_platform_interface/pubspec.yaml +++ b/packages/camera/camera_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.12.0 +version: 2.13.0 environment: sdk: ^3.9.0 diff --git a/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart b/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart index 9a9731062fdd..8453772f2441 100644 --- a/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart +++ b/packages/camera/camera_platform_interface/test/camera_platform_interface_test.dart @@ -520,6 +520,20 @@ void main() { }, ); + test( + 'Default implementation of setJpegImageQuality() should throw unimplemented error', + () { + // Arrange + final cameraPlatform = ExtendsCameraPlatform(); + + // Act & Assert + expect( + () => cameraPlatform.setJpegImageQuality(1, 50), + throwsUnimplementedError, + ); + }, + ); + test( 'Default implementation of supportsImageStreaming() should return false', () { diff --git a/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart b/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart index 15d1c34ef555..a52d725cf442 100644 --- a/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart +++ b/packages/camera/camera_platform_interface/test/method_channel/method_channel_camera_test.dart @@ -1302,6 +1302,25 @@ void main() { ), ]); }); + + test('Should set the image quality', () async { + // Arrange + final channel = MethodChannelMock( + channelName: 'plugins.flutter.io/camera', + methods: {'setJpegImageQuality': null}, + ); + + // Act + await camera.setJpegImageQuality(cameraId, 50); + + // Assert + expect(channel.log, [ + isMethodCall( + 'setJpegImageQuality', + arguments: {'cameraId': cameraId, 'quality': 50}, + ), + ]); + }); }); }); } diff --git a/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/internal/protocol/impl/DartVmService.java b/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/internal/protocol/impl/DartVmService.java index d4b7d168e8fd..d7b035481cb9 100644 --- a/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/internal/protocol/impl/DartVmService.java +++ b/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/internal/protocol/impl/DartVmService.java @@ -57,8 +57,10 @@ public final class DartVmService implements FlutterTestingProtocol { /** The JSON-RPC method for testing extension APIs. */ private static final String TESTING_EXTENSION_METHOD = "ext.flutter.driver"; + /** The JSON-RPC method for retrieving Dart isolate info. */ private static final String GET_ISOLATE_METHOD = "getIsolate"; + /** The JSON-RPC method for retrieving Dart VM info. */ private static final String GET_VM_METHOD = "getVM"; @@ -129,7 +131,8 @@ public Void apply(JsonRpcResponse response) { if (response.getError() == null) { return null; } else { - // TODO(https://github.com/android/android-test/issues/251): Update error case handling + // TODO(https://github.com/android/android-test/issues/251): Update error case + // handling // like // AmbiguousWidgetMatcherException, NoMatchingWidgetException after nailing down the // design with @@ -190,8 +193,8 @@ public Rect apply(List jsonResponses) { checkState( topLeft.getX() <= bottomRight.getX() && topLeft.getY() <= bottomRight.getY(), String.format( - "The coordinates of the bottom right vertex [%.1f, %.1f] are not actually to the" - + " bottom right of the top left vertex [%.1f, %.1f]!", + "The coordinates of the bottom right vertex [%.1f, %.1f] are not actually to" + + " the bottom right of the top left vertex [%.1f, %.1f]!", topLeft.getX(), topLeft.getY(), bottomRight.getX(), bottomRight.getY())); return new Rect( (int) topLeft.getX(), diff --git a/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/model/WidgetInfo.java b/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/model/WidgetInfo.java index 00d9f1493b90..439ad7c981e4 100644 --- a/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/model/WidgetInfo.java +++ b/packages/espresso/android/src/main/java/androidx/test/espresso/flutter/model/WidgetInfo.java @@ -27,10 +27,13 @@ public class WidgetInfo { /** A String representation of a Flutter widget's ValueKey. */ @Nullable private final String valueKey; + /** A String representation of the runtime type of the widget. */ private final String runtimeType; + /** The widget's text property. */ @Nullable private final String text; + /** The widget's tooltip property. */ @Nullable private final String tooltip; diff --git a/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileUtils.java b/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileUtils.java index 605b28e02a96..9b5e7e77d707 100644 --- a/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileUtils.java +++ b/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/FileUtils.java @@ -66,9 +66,11 @@ public static String getPathFromUri(@NonNull Context context, @NonNull Uri uri) String[] uriDocumentIdSplit = uriDocumentId.split(":"); if (uriDocumentIdSplit.length < 2) { - // We expect the URI document ID to contain its storage volume and name to determine its path. + // We expect the URI document ID to contain its storage volume and name to + // determine its path. throw new UnsupportedOperationException( - "Retrieving the path of a document with an unknown storage volume or name is unsupported by this plugin."); + "Retrieving the path of a document with an unknown storage volume or name is" + + " unsupported by this plugin."); } String documentStorageVolume = uriDocumentIdSplit[0]; @@ -208,7 +210,8 @@ private static String getBaseName(String fileName) { return fileName.substring(0, lastDotIndex); } - // From https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#sanitize-provided-filenames. + // From + // https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#sanitize-provided-filenames. protected static @Nullable String sanitizeFilename(@Nullable String displayName) { if (displayName == null) { return null; diff --git a/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/GeneratedFileSelectorApi.java b/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/GeneratedFileSelectorApi.java index 9f85509fb45a..885b1dbcf406 100644 --- a/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/GeneratedFileSelectorApi.java +++ b/packages/file_selector/file_selector_android/android/src/main/java/dev/flutter/packages/file_selector_android/GeneratedFileSelectorApi.java @@ -513,6 +513,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -521,6 +522,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -529,6 +531,7 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** * An API to call to native code to select files or directories. * @@ -544,6 +547,7 @@ void openFile( @Nullable String initialDirectory, @NonNull FileTypes allowedTypes, @NonNull NullableResult result); + /** * Opens a file dialog for loading files and returns a list of file responses chosen by the * user. @@ -552,6 +556,7 @@ void openFiles( @Nullable String initialDirectory, @NonNull FileTypes allowedTypes, @NonNull Result> result); + /** * Opens a file dialog for loading directories and returns a directory path. * @@ -564,6 +569,7 @@ void getDirectoryPath( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * Sets up an instance of `FileSelectorApi` to handle messages through the `binaryMessenger`. */ diff --git a/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java b/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java index 21b6dc445dee..0bd8772f5544 100644 --- a/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java +++ b/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileSelectorAndroidPluginTest.java @@ -214,7 +214,8 @@ public void openFilesReturnsSuccessfully() throws FileNotFoundException { } } - // This test was created when error handling was moved from FileUtils.java to FileSelectorApiImpl.java + // This test was created when error handling was moved from FileUtils.java to + // FileSelectorApiImpl.java // in https://github.com/flutter/packages/pull/8184, so as to maintain the existing test. // The behavior is actually an error case and should be fixed, // see: https://github.com/flutter/flutter/issues/159568. diff --git a/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileUtilsTest.java b/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileUtilsTest.java index ef640113fdbc..2f30e6499961 100644 --- a/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileUtilsTest.java +++ b/packages/file_selector/file_selector_android/android/src/test/java/dev/flutter/packages/file_selector_android/FileUtilsTest.java @@ -88,7 +88,8 @@ public void getPathFromUri_returnsExpectedPathForExternalDocumentUri() { @Test public void getPathFromUri_throwExceptionForExternalDocumentUriWithNonPrimaryStorageVolume() { - // Uri that represents Documents/test directory from some external storage volume ("external" for this test): + // Uri that represents Documents/test directory from some external storage volume ("external" + // for this test): Uri uri = Uri.parse( "content://com.android.externalstorage.documents/tree/external%3ADocuments%2Ftest"); @@ -255,7 +256,8 @@ public int update( // Mocks a malicious content provider attempting to use path indirection to modify files outside // of the intended directory. - // See https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#don%27t-trust-user-input. + // See + // https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#don%27t-trust-user-input. private static class MockMaliciousContentProvider extends ContentProvider { public static String PNG_URI = "content://dummy/a.png"; diff --git a/packages/flutter_plugin_android_lifecycle/example/android/app/src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle_example/MainActivity.java b/packages/flutter_plugin_android_lifecycle/example/android/app/src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle_example/MainActivity.java index cb90b0913864..21f6953d449e 100644 --- a/packages/flutter_plugin_android_lifecycle/example/android/app/src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle_example/MainActivity.java +++ b/packages/flutter_plugin_android_lifecycle/example/android/app/src/main/java/io/flutter/plugins/flutter_plugin_android_lifecycle_example/MainActivity.java @@ -40,7 +40,8 @@ public void onAttachedToActivity(ActivityPluginBinding binding) { // TODO(amirh): make this throw once the lifecycle API is available on stable. // https://github.com/flutter/flutter/issues/42875 // throw new RuntimeException( - // "The FlutterLifecycleAdapter did not correctly provide a Lifecycle instance. Source reference: " + // "The FlutterLifecycleAdapter did not correctly provide a Lifecycle instance. Source + // reference: " // + flutterPluginBinding.getLifecycle()); } Log.d(TAG, "Successfully obtained Lifecycle: " + lifecycle); diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index 515b93302174..7411866f1966 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -1,3 +1,7 @@ +## 17.2.2 + +- Fixes `pop()` restoring stale configuration when route has `onExit`, which could cause the popped route to reappear with async redirects. + ## 17.2.1 - Fixes chained top-level redirects not being fully resolved (e.g. `/ → /a → /b` stopping at `/a`). diff --git a/packages/go_router/lib/src/router.dart b/packages/go_router/lib/src/router.dart index 7e885742ec52..de8bdf1b8887 100644 --- a/packages/go_router/lib/src/router.dart +++ b/packages/go_router/lib/src/router.dart @@ -583,8 +583,13 @@ class GoRouter implements RouterConfig { log('popping ${routerDelegate.currentConfiguration.uri}'); return true; }()); + final RouteMatchList configBeforePop = routerDelegate.currentConfiguration; routerDelegate.pop(result); - restore(routerDelegate.currentConfiguration); + // Only restore when the pop completed synchronously (no onExit). + // If deferred, currentConfiguration is still the same instance. + if (!identical(routerDelegate.currentConfiguration, configBeforePop)) { + restore(routerDelegate.currentConfiguration); + } } /// Refresh the route. diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml index 0f0bde31e55d..95fe8002ca3d 100644 --- a/packages/go_router/pubspec.yaml +++ b/packages/go_router/pubspec.yaml @@ -1,7 +1,7 @@ name: go_router description: A declarative router for Flutter based on Navigation 2 supporting deep linking, data-driven routes and more -version: 17.2.1 +version: 17.2.2 repository: https://github.com/flutter/packages/tree/main/packages/go_router issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22 diff --git a/packages/go_router/test/on_exit_test.dart b/packages/go_router/test/on_exit_test.dart index 2b1d0873cb95..56f5c6119698 100644 --- a/packages/go_router/test/on_exit_test.dart +++ b/packages/go_router/test/on_exit_test.dart @@ -493,4 +493,89 @@ void main() { expect(onExitState2.fullPath, '/route-2/:id2'); }, ); + + // Regression test: pop() with onExit + async redirect must not restore + // stale configuration. + testWidgets( + 'pop does not call restore with stale config when route has onExit', + (WidgetTester tester) async { + final homeKey = UniqueKey(); + final detailKey = UniqueKey(); + + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (_, __) => DummyScreen(key: homeKey), + routes: [ + GoRoute( + path: 'detail', + onExit: (_, __) => true, + builder: (_, __) => DummyScreen(key: detailKey), + ), + ], + ), + ], + tester, + initialLocation: '/detail', + redirect: (_, GoRouterState state) async { + // Async redirect — completes in a later microtask. + await Future.delayed(Duration.zero); + return null; + }, + ); + + await tester.pumpAndSettle(); + expect(find.byKey(detailKey), findsOneWidget); + + router.pop(); + await tester.pumpAndSettle(); + + // The detail route should be gone after pop. + expect( + find.byKey(detailKey), + findsNothing, + reason: + 'Route with onExit should be properly popped ' + 'even when async redirect is present', + ); + expect(find.byKey(homeKey), findsOneWidget); + }, + ); + + // Verify that pop is correctly cancelled when onExit returns false. + testWidgets('pop is cancelled when onExit returns false', ( + WidgetTester tester, + ) async { + final homeKey = UniqueKey(); + final detailKey = UniqueKey(); + + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (_, __) => DummyScreen(key: homeKey), + routes: [ + GoRoute( + path: 'detail', + onExit: (_, __) => false, // Always prevent leaving. + builder: (_, __) => DummyScreen(key: detailKey), + ), + ], + ), + ], + tester, + initialLocation: '/detail', + ); + + await tester.pumpAndSettle(); + expect(find.byKey(detailKey), findsOneWidget); + + router.pop(); + await tester.pumpAndSettle(); + + // Should still be on the detail page. + expect(find.byKey(detailKey), findsOneWidget); + expect(find.byKey(homeKey), findsNothing); + }); } diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_marker_icons.dart index ec68617a9c69..93c68e130cf1 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_marker_icons.dart @@ -11,12 +11,8 @@ import 'place_advanced_marker.dart'; /// Page that demonstrates how to use custom [AdvanceMarker] icons. class AdvancedMarkerIconsPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerIconsPage({Key? key, required this.mapId}) - : super( - key: key, - const Icon(Icons.image_outlined), - 'Advanced marker icons', - ); + const AdvancedMarkerIconsPage({super.key, required this.mapId}) + : super(const Icon(Icons.image_outlined), 'Advanced marker icons'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_markers_clustering.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_markers_clustering.dart index 3fa8abdd1fd7..d9612ef93ec0 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_markers_clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/advanced_markers_clustering.dart @@ -15,9 +15,8 @@ import 'place_advanced_marker.dart'; /// Same as [ClusteringPage] but works with [AdvancedMarker]. class AdvancedMarkersClustering extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkersClustering({Key? key, required this.mapId}) + const AdvancedMarkersClustering({super.key, required this.mapId}) : super( - key: key, const Icon(Icons.place_outlined), 'Manage clusters of advanced markers', ); diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart index 19687ea1d688..07458f88e3c3 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/animate_camera.dart @@ -11,8 +11,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class AnimateCameraPage extends GoogleMapExampleAppPage { - const AnimateCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control, animated', key: key); + const AnimateCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control, animated'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart index e6630ee80cd0..9678c1da0f74 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/clustering.dart @@ -12,8 +12,8 @@ import 'page.dart'; /// Page for demonstrating marker clustering support. class ClusteringPage extends GoogleMapExampleAppPage { /// Default Constructor. - const ClusteringPage({Key? key}) - : super(const Icon(Icons.place), 'Manage clustering', key: key); + const ClusteringPage({super.key}) + : super(const Icon(Icons.place), 'Manage clustering'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/collision_behavior.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/collision_behavior.dart index 3078493a9c9a..09ed5741bfdc 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/collision_behavior.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/collision_behavior.dart @@ -13,11 +13,10 @@ import 'place_advanced_marker.dart'; /// Page demonstrating how to use AdvancedMarker's collision behavior. class AdvancedMarkerCollisionBehaviorPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerCollisionBehaviorPage({Key? key, required this.mapId}) + const AdvancedMarkerCollisionBehaviorPage({super.key, required this.mapId}) : super( const Icon(Icons.not_listed_location), 'Advanced marker collision behavior', - key: key, ); /// Map ID to use for the GoogleMap. diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart index 41df905569aa..5142cb8395d5 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/ground_overlay.dart @@ -13,8 +13,8 @@ import 'page.dart'; enum _GroundOverlayPlacing { position, bounds } class GroundOverlayPage extends GoogleMapExampleAppPage { - const GroundOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Ground overlay', key: key); + const GroundOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Ground overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/heatmap.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/heatmap.dart index ceb776fab5bb..12288074c79a 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/heatmap.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/heatmap.dart @@ -10,8 +10,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class HeatmapPage extends GoogleMapExampleAppPage { - const HeatmapPage({Key? key}) - : super(const Icon(Icons.map), 'Heatmaps', key: key); + const HeatmapPage({super.key}) : super(const Icon(Icons.map), 'Heatmaps'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart index d455721cdea1..a92bac367eee 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/lite_mode.dart @@ -14,8 +14,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class LiteModePage extends GoogleMapExampleAppPage { - const LiteModePage({Key? key}) - : super(const Icon(Icons.map), 'Lite mode', key: key); + const LiteModePage({super.key}) : super(const Icon(Icons.map), 'Lite mode'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart index b80c545b1093..286f078e7e43 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_click.dart @@ -14,8 +14,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapClickPage extends GoogleMapExampleAppPage { - const MapClickPage({Key? key}) - : super(const Icon(Icons.mouse), 'Map click', key: key); + const MapClickPage({super.key}) : super(const Icon(Icons.mouse), 'Map click'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart index 3a8d282c67a8..91a6073e0d66 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_coordinates.dart @@ -14,8 +14,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapCoordinatesPage extends GoogleMapExampleAppPage { - const MapCoordinatesPage({Key? key}) - : super(const Icon(Icons.map), 'Map coordinates', key: key); + const MapCoordinatesPage({super.key}) + : super(const Icon(Icons.map), 'Map coordinates'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart index e5836f05e079..270a521cd4a5 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart @@ -14,8 +14,8 @@ import 'main.dart'; import 'page.dart'; class MapIdPage extends GoogleMapExampleAppPage { - const MapIdPage({Key? key}) - : super(const Icon(Icons.map), 'Cloud-based maps styling', key: key); + const MapIdPage({super.key}) + : super(const Icon(Icons.map), 'Cloud-based maps styling'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart index d954ee7d3c7c..51ef0e9bb6c6 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_ui.dart @@ -17,8 +17,7 @@ final LatLngBounds sydneyBounds = LatLngBounds( ); class MapUiPage extends GoogleMapExampleAppPage { - const MapUiPage({Key? key}) - : super(const Icon(Icons.map), 'User interface', key: key); + const MapUiPage({super.key}) : super(const Icon(Icons.map), 'User interface'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart index 616d1525db32..ce6edd942aee 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/marker_icons.dart @@ -15,8 +15,8 @@ import 'custom_marker_icon.dart'; import 'page.dart'; class MarkerIconsPage extends GoogleMapExampleAppPage { - const MarkerIconsPage({Key? key}) - : super(const Icon(Icons.image), 'Marker icons', key: key); + const MarkerIconsPage({super.key}) + : super(const Icon(Icons.image), 'Marker icons'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart index a86067c4d1f2..7e042be8be0e 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/move_camera.dart @@ -10,8 +10,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class MoveCameraPage extends GoogleMapExampleAppPage { - const MoveCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control', key: key); + const MoveCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart index c5d224144a5c..bf88171bdc94 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/padding.dart @@ -9,8 +9,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class PaddingPage extends GoogleMapExampleAppPage { - const PaddingPage({Key? key}) - : super(const Icon(Icons.map), 'Add padding to the map', key: key); + const PaddingPage({super.key}) + : super(const Icon(Icons.map), 'Add padding to the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_advanced_marker.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_advanced_marker.dart index 41d73b4f04c5..41f76c91899e 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_advanced_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_advanced_marker.dart @@ -13,12 +13,8 @@ import 'page.dart'; /// Page demonstrating how to use Advanced [Marker] class. class PlaceAdvancedMarkerPage extends GoogleMapExampleAppPage { /// Default constructor. - const PlaceAdvancedMarkerPage({Key? key, required this.mapId}) - : super( - const Icon(Icons.place_outlined), - 'Place advanced marker', - key: key, - ); + const PlaceAdvancedMarkerPage({super.key, required this.mapId}) + : super(const Icon(Icons.place_outlined), 'Place advanced marker'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart index b8a6b88fefba..14cece83db68 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_circle.dart @@ -10,8 +10,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class PlaceCirclePage extends GoogleMapExampleAppPage { - const PlaceCirclePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place circle', key: key); + const PlaceCirclePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place circle'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart index c3f90629dfdd..d1c7e046f74c 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_marker.dart @@ -15,8 +15,8 @@ import 'custom_marker_icon.dart'; import 'page.dart'; class PlaceMarkerPage extends GoogleMapExampleAppPage { - const PlaceMarkerPage({Key? key}) - : super(const Icon(Icons.place), 'Place marker', key: key); + const PlaceMarkerPage({super.key}) + : super(const Icon(Icons.place), 'Place marker'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart index b70273179ee5..2f07af11af22 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polygon.dart @@ -10,8 +10,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class PlacePolygonPage extends GoogleMapExampleAppPage { - const PlacePolygonPage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polygon', key: key); + const PlacePolygonPage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polygon'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart index ce931ad2d5ca..2abbbc4d4c93 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/place_polyline.dart @@ -11,8 +11,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class PlacePolylinePage extends GoogleMapExampleAppPage { - const PlacePolylinePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polyline', key: key); + const PlacePolylinePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polyline'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart index fa4fa8bd8166..90b9ba2bdd5d 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/scrolling_map.dart @@ -14,8 +14,8 @@ import 'page.dart'; const LatLng _center = LatLng(32.080664, 34.9563837); class ScrollingMapPage extends GoogleMapExampleAppPage { - const ScrollingMapPage({Key? key}) - : super(const Icon(Icons.map), 'Scrolling map', key: key); + const ScrollingMapPage({super.key}) + : super(const Icon(Icons.map), 'Scrolling map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart index f94a7d280efc..cb86d19a0c8f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/snapshot.dart @@ -17,12 +17,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class SnapshotPage extends GoogleMapExampleAppPage { - const SnapshotPage({Key? key}) - : super( - const Icon(Icons.camera_alt), - 'Take a snapshot of the map', - key: key, - ); + const SnapshotPage({super.key}) + : super(const Icon(Icons.camera_alt), 'Take a snapshot of the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart index 524a9d450f92..5cc04da4d9b2 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/tile_overlay.dart @@ -13,8 +13,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'page.dart'; class TileOverlayPage extends GoogleMapExampleAppPage { - const TileOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Tile overlay', key: key); + const TileOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Tile overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index 6ce7cb2dd0e4..3ed908b3db42 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.19.8 + +* Updates internal implementation to use Kotlin Pigeon. + +## 2.19.7 + +* Fixes warnings in Java code. + ## 2.19.6 * Fixes the onTap callback for clustered pin info window taps. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle.kts b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle.kts index 61cdabfbbf01..636637dfaf44 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle.kts +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle.kts @@ -1,7 +1,10 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + group = "io.flutter.plugins.googlemaps" version = "1.0-SNAPSHOT" buildscript { + val kotlinVersion = "2.3.20" repositories { google() mavenCentral() @@ -9,6 +12,7 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:8.13.1") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") } } @@ -21,6 +25,13 @@ allprojects { plugins { id("com.android.library") + id("kotlin-android") +} + +kotlin { + compilerOptions { + jvmTarget = JvmTarget.fromTarget(JavaVersion.VERSION_17.toString()) + } } android { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CircleBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CircleBuilder.java index d1d2b178be9f..2bbe8beb1141 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CircleBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CircleBuilder.java @@ -4,11 +4,12 @@ package io.flutter.plugins.googlemaps; +import androidx.annotation.NonNull; import com.google.android.gms.maps.model.CircleOptions; import com.google.android.gms.maps.model.LatLng; class CircleBuilder implements CircleOptionsSink { - private final CircleOptions circleOptions; + private final @NonNull CircleOptions circleOptions; private final float density; private boolean consumeTapEvents; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CirclesController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CirclesController.java index 7ac1df8043e1..dbb0a6365f5b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CirclesController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/CirclesController.java @@ -9,10 +9,11 @@ import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.Circle; import com.google.android.gms.maps.model.CircleOptions; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; import java.util.HashMap; import java.util.List; import java.util.Map; +import kotlin.Result; +import kotlin.Unit; class CirclesController { @VisibleForTesting final Map circleIdToController; @@ -32,14 +33,14 @@ void setGoogleMap(GoogleMap googleMap) { this.googleMap = googleMap; } - void addCircles(@NonNull List circlesToAdd) { - for (Messages.PlatformCircle circleToAdd : circlesToAdd) { + void addCircles(@NonNull List circlesToAdd) { + for (PlatformCircle circleToAdd : circlesToAdd) { addCircle(circleToAdd); } } - void changeCircles(@NonNull List circlesToChange) { - for (Messages.PlatformCircle circleToChange : circlesToChange) { + void changeCircles(@NonNull List circlesToChange) { + for (PlatformCircle circleToChange : circlesToChange) { changeCircle(circleToChange); } } @@ -59,7 +60,7 @@ boolean onCircleTap(String googleCircleId) { if (circleId == null) { return false; } - flutterApi.onCircleTap(circleId, new NoOpVoidResult()); + flutterApi.onCircleTap(circleId, (Result result) -> Unit.INSTANCE); CircleController circleController = circleIdToController.get(circleId); if (circleController != null) { return circleController.consumeTapEvents(); @@ -67,7 +68,7 @@ boolean onCircleTap(String googleCircleId) { return false; } - void addCircle(@NonNull Messages.PlatformCircle circle) { + void addCircle(@NonNull PlatformCircle circle) { CircleBuilder circleBuilder = new CircleBuilder(density); String circleId = Convert.interpretCircleOptions(circle, circleBuilder); CircleOptions options = circleBuilder.build(); @@ -81,7 +82,7 @@ private void addCircle(String circleId, CircleOptions circleOptions, boolean con googleMapsCircleIdToDartCircleId.put(circle.getId(), circleId); } - private void changeCircle(@NonNull Messages.PlatformCircle circle) { + private void changeCircle(@NonNull PlatformCircle circle) { String circleId = circle.getCircleId(); CircleController circleController = circleIdToController.get(circleId); if (circleController != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java index 5921d690a0de..26ca58aef614 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java @@ -19,12 +19,12 @@ import com.google.maps.android.clustering.view.DefaultAdvancedMarkersClusterRenderer; import com.google.maps.android.clustering.view.DefaultClusterRenderer; import com.google.maps.android.collections.MarkerManager; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import kotlin.Result; +import kotlin.Unit; /** * Controls cluster managers and exposes interfaces for adding and removing cluster items for @@ -33,15 +33,15 @@ class ClusterManagersController implements GoogleMap.OnCameraIdleListener, ClusterManager.OnClusterClickListener { - @NonNull private final Context context; + private final @NonNull Context context; @VisibleForTesting @NonNull protected final HashMap> clusterManagerIdToManager; - @NonNull private final MapsCallbackApi flutterApi; - @Nullable private MarkerManager markerManager; - @Nullable private GoogleMap googleMap; - @NonNull private PlatformMarkerType markerType; + private final @NonNull MapsCallbackApi flutterApi; + private @Nullable MarkerManager markerManager; + private @Nullable GoogleMap googleMap; + private final @NonNull PlatformMarkerType markerType; @Nullable private ClusterManager.OnClusterItemClickListener clusterItemClickListener; @@ -107,8 +107,8 @@ private void initListenersForClusterManager( } /** Adds new ClusterManagers to the controller. */ - void addClusterManagers(@NonNull List clusterManagersToAdd) { - for (Messages.PlatformClusterManager clusterToAdd : clusterManagersToAdd) { + void addClusterManagers(@NonNull List clusterManagersToAdd) { + for (PlatformClusterManager clusterToAdd : clusterManagersToAdd) { addClusterManager(clusterToAdd.getIdentifier()); } } @@ -116,7 +116,7 @@ void addClusterManagers(@NonNull List clusterMa /** Adds new ClusterManager to the controller. */ void addClusterManager(String clusterManagerId) { ClusterManager clusterManager = - new ClusterManager(context, googleMap, markerManager); + new ClusterManager<>(context, googleMap, markerManager); initializeRenderer(clusterManager); clusterManagerIdToManager.put(clusterManagerId, clusterManager); } @@ -126,17 +126,12 @@ void addClusterManager(String clusterManagerId) { * advanced markers and MarkerClusterRenderer is used for default markers. */ private void initializeRenderer(ClusterManager clusterManager) { - final ClusterRenderer clusterRenderer; - switch (markerType) { - case ADVANCED_MARKER: - clusterRenderer = - new AdvancedMarkerClusterRenderer<>(context, googleMap, clusterManager, this); - break; - case MARKER: - default: - clusterRenderer = new MarkerClusterRenderer<>(context, googleMap, clusterManager, this); - break; - } + final ClusterRenderer clusterRenderer = + switch (markerType) { + case ADVANCED_MARKER -> + new AdvancedMarkerClusterRenderer<>(context, googleMap, clusterManager, this); + default -> new MarkerClusterRenderer<>(context, googleMap, clusterManager, this); + }; clusterManager.setRenderer(clusterRenderer); initListenersForClusterManager( clusterManager, this, clusterItemClickListener, clusterItemInfoWindowClickListener); @@ -154,7 +149,7 @@ public void removeClusterManagers(@NonNull List clusterManagerIdsToRemov * to this cluster manager is removed from the clusterManagerIdToManager and it will be garbage * collected later. */ - private void removeClusterManager(Object clusterManagerId) { + private void removeClusterManager(String clusterManagerId) { // Remove the cluster manager from the hash map to allow it to be garbage collected. final ClusterManager clusterManager = clusterManagerIdToManager.remove(clusterManagerId); @@ -213,14 +208,6 @@ void onClusterItemRendered(@NonNull MarkerBuilder item, @NonNull Marker marker) } } - /** Reads clusterManagerId from object data. */ - @SuppressWarnings("unchecked") - private static String getClusterManagerId(Object clusterManagerData) { - Map clusterMap = (Map) clusterManagerData; - // Ref: google_maps_flutter_platform_interface/lib/src/types/cluster_manager.dart ClusterManager.toJson() method. - return (String) clusterMap.get("clusterManagerId"); - } - /** * Requests all current clusters from the algorithm of the requested ClusterManager and converts * them to result response. @@ -229,7 +216,7 @@ private static String getClusterManagerId(Object clusterManagerData) { String clusterManagerId) { ClusterManager clusterManager = clusterManagerIdToManager.get(clusterManagerId); if (clusterManager == null) { - throw new Messages.FlutterError( + throw new FlutterError( "Invalid clusterManagerId", "getClusters called with invalid clusterManagerId:" + clusterManagerId, null); @@ -251,7 +238,8 @@ public boolean onClusterClick(Cluster cluster) { MarkerBuilder[] builders = cluster.getItems().toArray(new MarkerBuilder[0]); String clusterManagerId = builders[0].clusterManagerId(); flutterApi.onClusterTap( - Convert.clusterToPigeon(clusterManagerId, cluster), new NoOpVoidResult()); + Convert.clusterToPigeon(clusterManagerId, cluster), + (Result result) -> Unit.INSTANCE); } // Return false to allow the default behavior of the cluster click event to occur. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java index 364c0bd1f515..a127cbcc9a1e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java @@ -44,8 +44,6 @@ import com.google.maps.android.heatmaps.Gradient; import com.google.maps.android.heatmaps.WeightedLatLng; import io.flutter.FlutterInjector; -import io.flutter.plugins.googlemaps.Messages.FlutterError; -import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; @@ -55,20 +53,18 @@ /** Conversions between JSON-like values and GoogleMaps data types. */ class Convert { private static BitmapDescriptor toBitmapDescriptor( - Messages.PlatformBitmap platformBitmap, AssetManager assetManager, float density) { + PlatformBitmap platformBitmap, AssetManager assetManager, float density) { return toBitmapDescriptor( platformBitmap, assetManager, density, new BitmapDescriptorFactoryWrapper()); } private static BitmapDescriptor toBitmapDescriptor( - Messages.PlatformBitmap platformBitmap, + PlatformBitmap platformBitmap, AssetManager assetManager, float density, BitmapDescriptorFactoryWrapper wrapper) { Object bitmap = platformBitmap.getBitmap(); - if (bitmap instanceof Messages.PlatformBitmapDefaultMarker) { - Messages.PlatformBitmapDefaultMarker typedBitmap = - (Messages.PlatformBitmapDefaultMarker) bitmap; + if (bitmap instanceof PlatformBitmapDefaultMarker typedBitmap) { if (typedBitmap.getHue() == null) { return BitmapDescriptorFactory.defaultMarker(); } else { @@ -76,8 +72,7 @@ private static BitmapDescriptor toBitmapDescriptor( return BitmapDescriptorFactory.defaultMarker(hue); } } - if (bitmap instanceof Messages.PlatformBitmapAsset) { - Messages.PlatformBitmapAsset typedBitmap = (Messages.PlatformBitmapAsset) bitmap; + if (bitmap instanceof PlatformBitmapAsset typedBitmap) { final String assetPath = typedBitmap.getName(); final String assetPackage = typedBitmap.getPkg(); if (assetPackage == null) { @@ -90,27 +85,22 @@ private static BitmapDescriptor toBitmapDescriptor( .getLookupKeyForAsset(assetPath, assetPackage)); } } - if (bitmap instanceof Messages.PlatformBitmapAssetImage) { - Messages.PlatformBitmapAssetImage typedBitmap = (Messages.PlatformBitmapAssetImage) bitmap; + if (bitmap instanceof PlatformBitmapAssetImage typedBitmap) { final String assetImagePath = typedBitmap.getName(); return BitmapDescriptorFactory.fromAsset( FlutterInjector.instance().flutterLoader().getLookupKeyForAsset(assetImagePath)); } - if (bitmap instanceof Messages.PlatformBitmapBytes) { - Messages.PlatformBitmapBytes typedBitmap = (Messages.PlatformBitmapBytes) bitmap; + if (bitmap instanceof PlatformBitmapBytes typedBitmap) { return getBitmapFromBytesLegacy(typedBitmap); } - if (bitmap instanceof Messages.PlatformBitmapAssetMap) { - Messages.PlatformBitmapAssetMap typedBitmap = (Messages.PlatformBitmapAssetMap) bitmap; + if (bitmap instanceof PlatformBitmapAssetMap typedBitmap) { return getBitmapFromAsset( typedBitmap, assetManager, density, wrapper, new FlutterInjectorWrapper()); } - if (bitmap instanceof Messages.PlatformBitmapBytesMap) { - Messages.PlatformBitmapBytesMap typedBitmap = (Messages.PlatformBitmapBytesMap) bitmap; + if (bitmap instanceof PlatformBitmapBytesMap typedBitmap) { return getBitmapFromBytes(typedBitmap, density, wrapper); } - if (bitmap instanceof Messages.PlatformBitmapPinConfig) { - Messages.PlatformBitmapPinConfig pinConfigBitmap = (Messages.PlatformBitmapPinConfig) bitmap; + if (bitmap instanceof PlatformBitmapPinConfig pinConfigBitmap) { return getBitmapFromPinConfigBuilder(pinConfigBitmap, assetManager, density, wrapper); } throw new IllegalArgumentException("PlatformBitmap did not contain a supported subtype."); @@ -119,8 +109,7 @@ private static BitmapDescriptor toBitmapDescriptor( // Used for deprecated fromBytes bitmap descriptor. // Can be removed after support for "fromBytes" bitmap descriptor type is // removed. - private static BitmapDescriptor getBitmapFromBytesLegacy( - Messages.PlatformBitmapBytes bitmapBytes) { + private static BitmapDescriptor getBitmapFromBytesLegacy(PlatformBitmapBytes bitmapBytes) { try { Bitmap bitmap = toBitmap(bitmapBytes.getByteData()); return BitmapDescriptorFactory.fromBitmap(bitmap); @@ -143,12 +132,12 @@ private static BitmapDescriptor getBitmapFromBytesLegacy( */ @VisibleForTesting public static BitmapDescriptor getBitmapFromBytes( - Messages.PlatformBitmapBytesMap bytesMap, + PlatformBitmapBytesMap bytesMap, float density, BitmapDescriptorFactoryWrapper bitmapDescriptorFactory) { try { Bitmap bitmap = toBitmap(bytesMap.getByteData()); - Messages.PlatformMapBitmapScaling scalingMode = bytesMap.getBitmapScaling(); + PlatformMapBitmapScaling scalingMode = bytesMap.getBitmapScaling(); switch (scalingMode) { case AUTO: final Double width = bytesMap.getWidth(); @@ -171,7 +160,7 @@ public static BitmapDescriptor getBitmapFromBytes( toScaledBitmap(bitmap, targetWidth, targetHeight)); } else { // Scale image using given scale ratio - final float scale = density / bytesMap.getImagePixelRatio().floatValue(); + final float scale = (float) (density / bytesMap.getImagePixelRatio()); return bitmapDescriptorFactory.fromBitmap(toScaledBitmap(bitmap, scale)); } case NONE: @@ -184,7 +173,7 @@ public static BitmapDescriptor getBitmapFromBytes( } public static BitmapDescriptor getBitmapFromPinConfigBuilder( - Messages.PlatformBitmapPinConfig pinConfigBitmap, + PlatformBitmapPinConfig pinConfigBitmap, AssetManager assetManager, float density, BitmapDescriptorFactoryWrapper bitmapDescriptorFactory) { @@ -200,7 +189,7 @@ public static BitmapDescriptor getBitmapFromPinConfigBuilder( @VisibleForTesting public static PinConfig getPinConfigFromPlatformPinConfig( - Messages.PlatformBitmapPinConfig pinConfigBitmap, + PlatformBitmapPinConfig pinConfigBitmap, AssetManager assetManager, float density, BitmapDescriptorFactoryWrapper bitmapDescriptorFactory) { @@ -218,7 +207,7 @@ public static PinConfig getPinConfigFromPlatformPinConfig( } private static @Nullable PinConfig.Glyph buildPinGlyph( - Messages.PlatformBitmapPinConfig pinConfigBitmap, + PlatformBitmapPinConfig pinConfigBitmap, AssetManager assetManager, float density, BitmapDescriptorFactoryWrapper bitmapDescriptorFactory) { @@ -230,7 +219,7 @@ public static PinConfig getPinConfigFromPlatformPinConfig( : new PinConfig.Glyph(glyphText); } - final Messages.PlatformBitmap glyphBitmap = pinConfigBitmap.getGlyphBitmap(); + final PlatformBitmap glyphBitmap = pinConfigBitmap.getGlyphBitmap(); if (glyphBitmap != null) { return new PinConfig.Glyph( toBitmapDescriptor(glyphBitmap, assetManager, density, bitmapDescriptorFactory)); @@ -243,8 +232,8 @@ public static PinConfig getPinConfigFromPlatformPinConfig( return null; } - private static @Nullable Integer nullableColor(@Nullable Messages.PlatformColor color) { - return color == null ? null : color.getArgbValue().intValue(); + private static @Nullable Integer nullableColor(@Nullable PlatformColor color) { + return color == null ? null : (int) color.getArgbValue(); } private static void applyIfNotNull(@Nullable T value, Consumer setter) { @@ -275,7 +264,7 @@ private static void applyIfNotNull(@Nullable T value, Consumer setter) { */ @VisibleForTesting public static BitmapDescriptor getBitmapFromAsset( - Messages.PlatformBitmapAssetMap assetMap, + PlatformBitmapAssetMap assetMap, AssetManager assetManager, float density, BitmapDescriptorFactoryWrapper bitmapDescriptorFactory, @@ -283,14 +272,12 @@ public static BitmapDescriptor getBitmapFromAsset( final String assetName = assetMap.getAssetName(); final String assetKey = flutterInjector.getLookupKeyForAsset(assetName); - Messages.PlatformMapBitmapScaling scalingMode = assetMap.getBitmapScaling(); + PlatformMapBitmapScaling scalingMode = assetMap.getBitmapScaling(); switch (scalingMode) { case AUTO: final Double width = assetMap.getWidth(); final Double height = assetMap.getHeight(); - InputStream inputStream = null; - try { - inputStream = assetManager.open(assetKey); + try (InputStream inputStream = assetManager.open(assetKey)) { Bitmap bitmap = BitmapFactory.decodeStream(inputStream); if (width != null || height != null) { @@ -310,19 +297,11 @@ public static BitmapDescriptor getBitmapFromAsset( toScaledBitmap(bitmap, targetWidth, targetHeight)); } else { // Scale image using given scale. - final float scale = density / assetMap.getImagePixelRatio().floatValue(); + final float scale = (float) (density / assetMap.getImagePixelRatio()); return bitmapDescriptorFactory.fromBitmap(toScaledBitmap(bitmap, scale)); } } catch (Exception e) { throw new IllegalArgumentException("'asset' cannot open asset: " + assetName, e); - } finally { - if (inputStream != null) { - try { - inputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } } case NONE: break; @@ -332,66 +311,52 @@ public static BitmapDescriptor getBitmapFromAsset( } static @NonNull CameraPosition cameraPositionFromPigeon( - @NonNull Messages.PlatformCameraPosition position) { + @NonNull PlatformCameraPosition position) { final CameraPosition.Builder builder = CameraPosition.builder(); - builder.bearing(position.getBearing().floatValue()); + builder.bearing((float) position.getBearing()); builder.target(latLngFromPigeon(position.getTarget())); - builder.tilt(position.getTilt().floatValue()); - builder.zoom(position.getZoom().floatValue()); + builder.tilt((float) position.getTilt()); + builder.zoom((float) position.getZoom()); return builder.build(); } - static CameraUpdate cameraUpdateFromPigeon(Messages.PlatformCameraUpdate update, float density) { + static CameraUpdate cameraUpdateFromPigeon(PlatformCameraUpdate update, float density) { Object cameraUpdate = update.getCameraUpdate(); - if (cameraUpdate instanceof Messages.PlatformCameraUpdateNewCameraPosition) { - Messages.PlatformCameraUpdateNewCameraPosition newCameraPosition = - (Messages.PlatformCameraUpdateNewCameraPosition) cameraUpdate; + if (cameraUpdate instanceof PlatformCameraUpdateNewCameraPosition newCameraPosition) { return CameraUpdateFactory.newCameraPosition( cameraPositionFromPigeon(newCameraPosition.getCameraPosition())); } - if (cameraUpdate instanceof Messages.PlatformCameraUpdateNewLatLng) { - Messages.PlatformCameraUpdateNewLatLng newLatLng = - (Messages.PlatformCameraUpdateNewLatLng) cameraUpdate; + if (cameraUpdate instanceof PlatformCameraUpdateNewLatLng newLatLng) { return CameraUpdateFactory.newLatLng(latLngFromPigeon(newLatLng.getLatLng())); } - if (cameraUpdate instanceof Messages.PlatformCameraUpdateNewLatLngZoom) { - Messages.PlatformCameraUpdateNewLatLngZoom newLatLngZoom = - (Messages.PlatformCameraUpdateNewLatLngZoom) cameraUpdate; + if (cameraUpdate instanceof PlatformCameraUpdateNewLatLngZoom newLatLngZoom) { return CameraUpdateFactory.newLatLngZoom( - latLngFromPigeon(newLatLngZoom.getLatLng()), newLatLngZoom.getZoom().floatValue()); + latLngFromPigeon(newLatLngZoom.getLatLng()), (float) newLatLngZoom.getZoom()); } - if (cameraUpdate instanceof Messages.PlatformCameraUpdateNewLatLngBounds) { - Messages.PlatformCameraUpdateNewLatLngBounds newLatLngBounds = - (Messages.PlatformCameraUpdateNewLatLngBounds) cameraUpdate; + if (cameraUpdate instanceof PlatformCameraUpdateNewLatLngBounds newLatLngBounds) { return CameraUpdateFactory.newLatLngBounds( latLngBoundsFromPigeon(newLatLngBounds.getBounds()), (int) (newLatLngBounds.getPadding() * density)); } - if (cameraUpdate instanceof Messages.PlatformCameraUpdateScrollBy) { - Messages.PlatformCameraUpdateScrollBy scrollBy = - (Messages.PlatformCameraUpdateScrollBy) cameraUpdate; + if (cameraUpdate instanceof PlatformCameraUpdateScrollBy scrollBy) { return CameraUpdateFactory.scrollBy( - scrollBy.getDx().floatValue() * density, scrollBy.getDy().floatValue() * density); + (float) scrollBy.getDx() * density, (float) scrollBy.getDy() * density); } - if (cameraUpdate instanceof Messages.PlatformCameraUpdateZoomBy) { - Messages.PlatformCameraUpdateZoomBy zoomBy = - (Messages.PlatformCameraUpdateZoomBy) cameraUpdate; + if (cameraUpdate instanceof PlatformCameraUpdateZoomBy zoomBy) { final Point focus = pointFromPigeon(zoomBy.getFocus(), density); return (focus != null) - ? CameraUpdateFactory.zoomBy(zoomBy.getAmount().floatValue(), focus) - : CameraUpdateFactory.zoomBy(zoomBy.getAmount().floatValue()); + ? CameraUpdateFactory.zoomBy((float) zoomBy.getAmount(), focus) + : CameraUpdateFactory.zoomBy((float) zoomBy.getAmount()); } - if (cameraUpdate instanceof Messages.PlatformCameraUpdateZoomTo) { - Messages.PlatformCameraUpdateZoomTo zoomTo = - (Messages.PlatformCameraUpdateZoomTo) cameraUpdate; - return CameraUpdateFactory.zoomTo(zoomTo.getZoom().floatValue()); + if (cameraUpdate instanceof PlatformCameraUpdateZoomTo zoomTo) { + return CameraUpdateFactory.zoomTo((float) zoomTo.getZoom()); } - if (cameraUpdate instanceof Messages.PlatformCameraUpdateZoom) { - Messages.PlatformCameraUpdateZoom zoom = (Messages.PlatformCameraUpdateZoom) cameraUpdate; + if (cameraUpdate instanceof PlatformCameraUpdateZoom zoom) { return (zoom.getOut()) ? CameraUpdateFactory.zoomOut() : CameraUpdateFactory.zoomIn(); } throw new IllegalArgumentException( - "PlatformCameraUpdate's cameraUpdate field must be one of the PlatformCameraUpdate... case classes."); + "PlatformCameraUpdate's cameraUpdate field must be one of the PlatformCameraUpdate... case" + + " classes."); } private static @Nullable Float nullableDoubleToFloat(@Nullable Double d) { @@ -402,20 +367,14 @@ private static int toInt(Object o) { return ((Number) o).intValue(); } - static int toMapType(@NonNull Messages.PlatformMapType type) { - switch (type) { - case NONE: - return MAP_TYPE_NONE; - case NORMAL: - return MAP_TYPE_NORMAL; - case SATELLITE: - return MAP_TYPE_SATELLITE; - case TERRAIN: - return MAP_TYPE_TERRAIN; - case HYBRID: - return MAP_TYPE_HYBRID; - } - return MAP_TYPE_NORMAL; + static int toMapType(@NonNull PlatformMapType type) { + return switch (type) { + case NONE -> MAP_TYPE_NONE; + case NORMAL -> MAP_TYPE_NORMAL; + case SATELLITE -> MAP_TYPE_SATELLITE; + case TERRAIN -> MAP_TYPE_TERRAIN; + case HYBRID -> MAP_TYPE_HYBRID; + }; } // For now, suppress the deprecation warning for LEGACY; in theory using it @@ -426,56 +385,40 @@ static int toMapType(@NonNull Messages.PlatformMapType type) { // in Dart to actually request the platform default (which is what the server // is already doing in practice currently). @SuppressWarnings("deprecation") - static @Nullable MapsInitializer.Renderer toMapRendererType( - @Nullable Messages.PlatformRendererType type) { + static @Nullable MapsInitializer.Renderer toMapRendererType(@Nullable PlatformRendererType type) { if (type == null) { return null; } - switch (type) { - case LATEST: - return MapsInitializer.Renderer.LATEST; - case LEGACY: - return MapsInitializer.Renderer.LEGACY; - } - return null; + return switch (type) { + case LATEST -> MapsInitializer.Renderer.LATEST; + case LEGACY -> MapsInitializer.Renderer.LEGACY; + }; } - static @NonNull Messages.PlatformCameraPosition cameraPositionToPigeon( - @NonNull CameraPosition position) { - return new Messages.PlatformCameraPosition.Builder() - .setBearing((double) position.bearing) - .setTarget(latLngToPigeon(position.target)) - .setTilt((double) position.tilt) - .setZoom((double) position.zoom) - .build(); + static @NonNull PlatformCameraPosition cameraPositionToPigeon(@NonNull CameraPosition position) { + return new PlatformCameraPosition( + position.bearing, latLngToPigeon(position.target), position.tilt, position.zoom); } - static Messages.PlatformLatLngBounds latLngBoundsToPigeon(LatLngBounds latLngBounds) { - return new Messages.PlatformLatLngBounds.Builder() - .setNortheast(latLngToPigeon(latLngBounds.northeast)) - .setSouthwest(latLngToPigeon(latLngBounds.southwest)) - .build(); + static PlatformLatLngBounds latLngBoundsToPigeon(LatLngBounds latLngBounds) { + return new PlatformLatLngBounds( + latLngToPigeon(latLngBounds.northeast), latLngToPigeon(latLngBounds.southwest)); } - static @NonNull LatLngBounds latLngBoundsFromPigeon( - @NonNull Messages.PlatformLatLngBounds bounds) { + static @NonNull LatLngBounds latLngBoundsFromPigeon(@NonNull PlatformLatLngBounds bounds) { return new LatLngBounds( latLngFromPigeon(bounds.getSouthwest()), latLngFromPigeon(bounds.getNortheast())); } - static Messages.PlatformLatLng latLngToPigeon(LatLng latLng) { - return new Messages.PlatformLatLng.Builder() - .setLatitude(latLng.latitude) - .setLongitude(latLng.longitude) - .build(); + static PlatformLatLng latLngToPigeon(LatLng latLng) { + return new PlatformLatLng(latLng.latitude, latLng.longitude); } - static LatLng latLngFromPigeon(Messages.PlatformLatLng latLng) { + static LatLng latLngFromPigeon(PlatformLatLng latLng) { return new LatLng(latLng.getLatitude(), latLng.getLongitude()); } - static Messages.PlatformCluster clusterToPigeon( - String clusterManagerId, Cluster cluster) { + static PlatformCluster clusterToPigeon(String clusterManagerId, Cluster cluster) { int clusterSize = cluster.getSize(); String[] markerIds = new String[clusterSize]; MarkerBuilder[] markerBuilders = cluster.getItems().toArray(new MarkerBuilder[clusterSize]); @@ -487,12 +430,11 @@ static Messages.PlatformCluster clusterToPigeon( markerIds[i] = markerBuilder.markerId(); } - return new Messages.PlatformCluster.Builder() - .setClusterManagerId(clusterManagerId) - .setPosition(latLngToPigeon(cluster.getPosition())) - .setBounds(latLngBoundsToPigeon(latLngBoundsBuilder.build())) - .setMarkerIds(Arrays.asList(markerIds)) - .build(); + return new PlatformCluster( + clusterManagerId, + latLngToPigeon(cluster.getPosition()), + latLngBoundsToPigeon(latLngBoundsBuilder.build()), + Arrays.asList(markerIds)); } /** @@ -501,25 +443,25 @@ static Messages.PlatformCluster clusterToPigeon( * @param weightedLatLng The Pigeon weighted lat/lng. * @return The list of WeightedLatLng. */ - static WeightedLatLng weightedLatLngFromPigeon(Messages.PlatformWeightedLatLng weightedLatLng) { + static WeightedLatLng weightedLatLngFromPigeon(PlatformWeightedLatLng weightedLatLng) { return new WeightedLatLng( latLngFromPigeon(weightedLatLng.getPoint()), weightedLatLng.getWeight()); } - static Point pointFromPigeon(Messages.PlatformPoint point) { - return new Point(point.getX().intValue(), point.getY().intValue()); + static Point pointFromPigeon(PlatformPoint point) { + return new Point((int) point.getX(), (int) point.getY()); } @Nullable - static Point pointFromPigeon(@Nullable Messages.PlatformDoublePair point, float density) { + static Point pointFromPigeon(@Nullable PlatformDoublePair point, float density) { if (point == null) { return null; } return new Point((int) (point.getX() * density), (int) (point.getY() * density)); } - static Messages.PlatformPoint pointToPigeon(Point point) { - return new Messages.PlatformPoint.Builder().setX((long) point.x).setY((long) point.y).build(); + static PlatformPoint pointToPigeon(Point point) { + return new PlatformPoint(point.x, point.y); } private static Bitmap toBitmap(byte[] bmpData) { @@ -551,10 +493,10 @@ private static Bitmap toScaledBitmap(Bitmap bitmap, int width, int height) { } static void interpretMapConfiguration( - @NonNull Messages.PlatformMapConfiguration config, @NonNull GoogleMapOptionsSink sink) { - final Messages.PlatformCameraTargetBounds cameraTargetBounds = config.getCameraTargetBounds(); + @NonNull PlatformMapConfiguration config, @NonNull GoogleMapOptionsSink sink) { + final PlatformCameraTargetBounds cameraTargetBounds = config.getCameraTargetBounds(); if (cameraTargetBounds != null) { - final @Nullable Messages.PlatformLatLngBounds bounds = cameraTargetBounds.getBounds(); + final @Nullable PlatformLatLngBounds bounds = cameraTargetBounds.getBounds(); sink.setCameraTargetBounds(bounds == null ? null : latLngBoundsFromPigeon(bounds)); } final Boolean compassEnabled = config.getCompassEnabled(); @@ -565,23 +507,23 @@ static void interpretMapConfiguration( if (mapToolbarEnabled != null) { sink.setMapToolbarEnabled(mapToolbarEnabled); } - final Messages.PlatformMapType mapType = config.getMapType(); + final PlatformMapType mapType = config.getMapType(); if (mapType != null) { sink.setMapType(toMapType(mapType)); } - final Messages.PlatformZoomRange minMaxZoomPreference = config.getMinMaxZoomPreference(); + final PlatformZoomRange minMaxZoomPreference = config.getMinMaxZoomPreference(); if (minMaxZoomPreference != null) { sink.setMinMaxZoomPreference( nullableDoubleToFloat(minMaxZoomPreference.getMin()), nullableDoubleToFloat(minMaxZoomPreference.getMax())); } - final Messages.PlatformEdgeInsets padding = config.getPadding(); + final PlatformEdgeInsets padding = config.getPadding(); if (padding != null) { sink.setPadding( - padding.getTop().floatValue(), - padding.getLeft().floatValue(), - padding.getBottom().floatValue(), - padding.getRight().floatValue()); + (float) padding.getTop(), + (float) padding.getLeft(), + (float) padding.getBottom(), + (float) padding.getRight()); } final Boolean rotateGesturesEnabled = config.getRotateGesturesEnabled(); if (rotateGesturesEnabled != null) { @@ -639,42 +581,41 @@ static void interpretMapConfiguration( /** Set the options in the given object to marker options sink. */ static void interpretMarkerOptions( - Messages.PlatformMarker marker, + PlatformMarker marker, MarkerOptionsSink sink, AssetManager assetManager, float density, BitmapDescriptorFactoryWrapper wrapper) { - sink.setAlpha(marker.getAlpha().floatValue()); - sink.setAnchor(marker.getAnchor().getX().floatValue(), marker.getAnchor().getY().floatValue()); + sink.setAlpha((float) marker.getAlpha()); + sink.setAnchor((float) marker.getAnchor().getX(), (float) marker.getAnchor().getY()); sink.setConsumeTapEvents(marker.getConsumeTapEvents()); sink.setDraggable(marker.getDraggable()); sink.setFlat(marker.getFlat()); sink.setIcon(toBitmapDescriptor(marker.getIcon(), assetManager, density, wrapper)); interpretInfoWindowOptions(sink, marker.getInfoWindow()); sink.setPosition(latLngFromPigeon(marker.getPosition())); - sink.setRotation(marker.getRotation().floatValue()); + sink.setRotation((float) marker.getRotation()); sink.setVisible(marker.getVisible()); - sink.setZIndex(marker.getZIndex().floatValue()); + sink.setZIndex((float) marker.getZIndex()); sink.setCollisionBehavior(collisionBehaviorFromPigeon(marker.getCollisionBehavior())); } private static void interpretInfoWindowOptions( - MarkerOptionsSink sink, Messages.PlatformInfoWindow infoWindow) { + MarkerOptionsSink sink, PlatformInfoWindow infoWindow) { String title = infoWindow.getTitle(); if (title != null) { sink.setInfoWindowText(title, infoWindow.getSnippet()); } - Messages.PlatformDoublePair infoWindowAnchor = infoWindow.getAnchor(); - sink.setInfoWindowAnchor( - infoWindowAnchor.getX().floatValue(), infoWindowAnchor.getY().floatValue()); + PlatformDoublePair infoWindowAnchor = infoWindow.getAnchor(); + sink.setInfoWindowAnchor((float) infoWindowAnchor.getX(), (float) infoWindowAnchor.getY()); } - static String interpretPolygonOptions(Messages.PlatformPolygon polygon, PolygonOptionsSink sink) { + static String interpretPolygonOptions(PlatformPolygon polygon, PolygonOptionsSink sink) { sink.setConsumeTapEvents(polygon.getConsumesTapEvents()); sink.setGeodesic(polygon.getGeodesic()); sink.setVisible(polygon.getVisible()); - sink.setFillColor(polygon.getFillColor().getArgbValue().intValue()); - sink.setStrokeColor(polygon.getStrokeColor().getArgbValue().intValue()); + sink.setFillColor((int) polygon.getFillColor().getArgbValue()); + sink.setStrokeColor((int) polygon.getStrokeColor().getArgbValue()); sink.setStrokeWidth(polygon.getStrokeWidth()); sink.setZIndex(polygon.getZIndex()); sink.setPoints(pointsFromPigeon(polygon.getPoints())); @@ -682,16 +623,12 @@ static String interpretPolygonOptions(Messages.PlatformPolygon polygon, PolygonO return polygon.getPolygonId(); } - static int jointTypeFromPigeon(Messages.PlatformJointType jointType) { - switch (jointType) { - case MITERED: - return JointType.DEFAULT; - case BEVEL: - return JointType.BEVEL; - case ROUND: - return JointType.ROUND; - } - return JointType.DEFAULT; + static int jointTypeFromPigeon(PlatformJointType jointType) { + return switch (jointType) { + case MITERED -> JointType.DEFAULT; + case BEVEL -> JointType.BEVEL; + case ROUND -> JointType.ROUND; + }; } /** @@ -702,26 +639,23 @@ static int jointTypeFromPigeon(Messages.PlatformJointType jointType) { * @return The integer constant corresponding to the collision behavior. */ static int collisionBehaviorFromPigeon( - @NonNull Messages.PlatformMarkerCollisionBehavior collisionBehavior) { - switch (collisionBehavior) { - case REQUIRED_DISPLAY: - return AdvancedMarkerOptions.CollisionBehavior.REQUIRED; - case OPTIONAL_AND_HIDES_LOWER_PRIORITY: - return AdvancedMarkerOptions.CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY; - case REQUIRED_AND_HIDES_OPTIONAL: - return AdvancedMarkerOptions.CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL; - default: - return AdvancedMarkerOptions.CollisionBehavior.REQUIRED; - } + @NonNull PlatformMarkerCollisionBehavior collisionBehavior) { + return switch (collisionBehavior) { + case REQUIRED_DISPLAY -> AdvancedMarkerOptions.CollisionBehavior.REQUIRED; + case OPTIONAL_AND_HIDES_LOWER_PRIORITY -> + AdvancedMarkerOptions.CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY; + case REQUIRED_AND_HIDES_OPTIONAL -> + AdvancedMarkerOptions.CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL; + }; } static String interpretPolylineOptions( - Messages.PlatformPolyline polyline, + PlatformPolyline polyline, PolylineOptionsSink sink, AssetManager assetManager, float density) { sink.setConsumeTapEvents(polyline.getConsumesTapEvents()); - sink.setColor(polyline.getColor().getArgbValue().intValue()); + sink.setColor((int) polyline.getColor().getArgbValue()); sink.setEndCap(capFromPigeon(polyline.getEndCap(), assetManager, density)); sink.setStartCap(capFromPigeon(polyline.getStartCap(), assetManager, density)); sink.setGeodesic(polyline.getGeodesic()); @@ -734,12 +668,12 @@ static String interpretPolylineOptions( return polyline.getPolylineId(); } - static String interpretCircleOptions(Messages.PlatformCircle circle, CircleOptionsSink sink) { + static String interpretCircleOptions(PlatformCircle circle, CircleOptionsSink sink) { sink.setConsumeTapEvents(circle.getConsumeTapEvents()); - sink.setFillColor(circle.getFillColor().getArgbValue().intValue()); - sink.setStrokeColor(circle.getStrokeColor().getArgbValue().intValue()); + sink.setFillColor((int) circle.getFillColor().getArgbValue()); + sink.setStrokeColor((int) circle.getStrokeColor().getArgbValue()); sink.setStrokeWidth(circle.getStrokeWidth()); - sink.setZIndex(circle.getZIndex().floatValue()); + sink.setZIndex((float) circle.getZIndex()); sink.setCenter(latLngFromPigeon(circle.getCenter())); sink.setRadius(circle.getRadius()); sink.setVisible(circle.getVisible()); @@ -749,26 +683,14 @@ static String interpretCircleOptions(Messages.PlatformCircle circle, CircleOptio /** * Set the options in the given heatmap object to the given sink. * - * @param data the object expected to be a Map containing the heatmap options. The options map is - * expected to have the following structure: - *
{@code
-   * {
-   *   "heatmapId": String,
-   *   "data": List, // List of serialized weighted lat/lng
-   *   "gradient": Map, // Serialized heatmap gradient
-   *   "maxIntensity": Double,
-   *   "opacity": Double,
-   *   "radius": Integer
-   * }
-   * }
- * + * @param heatmap the heatmap object to read settings from. * @param sink the HeatmapOptionsSink where the options will be set. * @return the heatmapId. * @throws IllegalArgumentException if heatmapId is null. */ - static String interpretHeatmapOptions(Messages.PlatformHeatmap heatmap, HeatmapOptionsSink sink) { + static String interpretHeatmapOptions(PlatformHeatmap heatmap, HeatmapOptionsSink sink) { sink.setWeightedData(weightedDataFromPigeon(heatmap.getData())); - final Messages.PlatformHeatmapGradient gradient = heatmap.getGradient(); + final PlatformHeatmapGradient gradient = heatmap.getGradient(); if (gradient != null) { sink.setGradient(gradientFromPigeon(gradient)); } @@ -777,14 +699,14 @@ static String interpretHeatmapOptions(Messages.PlatformHeatmap heatmap, HeatmapO sink.setMaxIntensity(maxIntensity); } sink.setOpacity(heatmap.getOpacity()); - sink.setRadius(heatmap.getRadius().intValue()); + sink.setRadius((int) heatmap.getRadius()); return heatmap.getHeatmapId(); } - static List pointsFromPigeon(List data) { + static List pointsFromPigeon(List data) { final List points = new ArrayList<>(data.size()); - for (Messages.PlatformLatLng rawPoint : data) { + for (PlatformLatLng rawPoint : data) { points.add(new LatLng(rawPoint.getLatitude(), rawPoint.getLongitude())); } return points; @@ -797,10 +719,10 @@ static List pointsFromPigeon(List data) { * @return a list of WeightedLatLng objects. */ @VisibleForTesting - static List weightedDataFromPigeon(List data) { + static List weightedDataFromPigeon(List data) { final List weightedData = new ArrayList<>(data.size()); - for (Messages.PlatformWeightedLatLng rawWeightedPoint : data) { + for (PlatformWeightedLatLng rawWeightedPoint : data) { weightedData.add(weightedLatLngFromPigeon(rawWeightedPoint)); } return weightedData; @@ -813,11 +735,11 @@ static List weightedDataFromPigeon(List colorData = gradient.getColors(); + static Gradient gradientFromPigeon(PlatformHeatmapGradient gradient) { + final List colorData = gradient.getColors(); final int[] colors = new int[colorData.size()]; for (int i = 0; i < colorData.size(); i++) { - colors[i] = colorData.get(i).getArgbValue().intValue(); + colors[i] = (int) colorData.get(i).getArgbValue(); } final List startPointData = gradient.getStartPoints(); @@ -826,25 +748,24 @@ static Gradient gradientFromPigeon(Messages.PlatformHeatmapGradient gradient) { startPoints[i] = startPointData.get(i).floatValue(); } - return new Gradient(colors, startPoints, gradient.getColorMapSize().intValue()); + return new Gradient(colors, startPoints, (int) gradient.getColorMapSize()); } - private static List> toHoles(List> data) { + private static List> toHoles(List> data) { final List> holes = new ArrayList<>(data.size()); - for (List hole : data) { + for (List hole : data) { holes.add(pointsFromPigeon(hole)); } return holes; } - private static List patternFromPigeon( - List patternItems) { + private static List patternFromPigeon(List patternItems) { if (patternItems.isEmpty()) { return null; } final List pattern = new ArrayList<>(); - for (Messages.PlatformPatternItem patternItem : patternItems) { + for (PlatformPatternItem patternItem : patternItems) { switch (patternItem.getType()) { case DOT: pattern.add(new Dot()); @@ -862,37 +783,32 @@ private static List patternFromPigeon( return pattern; } - private static Cap capFromPigeon( - Messages.PlatformCap cap, AssetManager assetManager, float density) { - switch (cap.getType()) { - case BUTT_CAP: - return new ButtCap(); - case ROUND_CAP: - return new RoundCap(); - case SQUARE_CAP: - return new SquareCap(); - case CUSTOM_CAP: + private static Cap capFromPigeon(PlatformCap cap, AssetManager assetManager, float density) { + return switch (cap.getType()) { + case BUTT_CAP -> new ButtCap(); + case ROUND_CAP -> new RoundCap(); + case SQUARE_CAP -> new SquareCap(); + case CUSTOM_CAP -> { if (cap.getRefWidth() == null) { throw new IllegalArgumentException("A Custom Cap must specify a refWidth value."); } - return new CustomCap( + yield new CustomCap( toBitmapDescriptor(cap.getBitmapDescriptor(), assetManager, density), cap.getRefWidth().floatValue()); - } - throw new IllegalArgumentException("Unrecognized PlatformCap type: " + cap.getType()); + } + }; } - static String interpretTileOverlayOptions( - Messages.PlatformTileOverlay tileOverlay, TileOverlaySink sink) { + static String interpretTileOverlayOptions(PlatformTileOverlay tileOverlay, TileOverlaySink sink) { sink.setFadeIn(tileOverlay.getFadeIn()); - sink.setTransparency(tileOverlay.getTransparency().floatValue()); + sink.setTransparency((float) tileOverlay.getTransparency()); sink.setZIndex(tileOverlay.getZIndex()); sink.setVisible(tileOverlay.getVisible()); return tileOverlay.getTileOverlayId(); } - static Tile tileFromPigeon(Messages.PlatformTile tile) { - return new Tile(tile.getWidth().intValue(), tile.getHeight().intValue(), tile.getData()); + static Tile tileFromPigeon(PlatformTile tile) { + return new Tile((int) tile.getWidth(), (int) tile.getHeight(), tile.getData()); } /** @@ -910,20 +826,19 @@ static Tile tileFromPigeon(Messages.PlatformTile tile) { * @throws IllegalArgumentException if required fields are missing or invalid. */ static @NonNull String interpretGroundOverlayOptions( - @NonNull Messages.PlatformGroundOverlay groundOverlay, + @NonNull PlatformGroundOverlay groundOverlay, @NonNull GroundOverlaySink sink, @NonNull AssetManager assetManager, float density, @NonNull BitmapDescriptorFactoryWrapper wrapper) { - sink.setTransparency(groundOverlay.getTransparency().floatValue()); - sink.setZIndex(groundOverlay.getZIndex().floatValue()); + sink.setTransparency((float) groundOverlay.getTransparency()); + sink.setZIndex((float) groundOverlay.getZIndex()); sink.setVisible(groundOverlay.getVisible()); if (groundOverlay.getAnchor() != null) { sink.setAnchor( - groundOverlay.getAnchor().getX().floatValue(), - groundOverlay.getAnchor().getY().floatValue()); + (float) groundOverlay.getAnchor().getX(), (float) groundOverlay.getAnchor().getY()); } - sink.setBearing(groundOverlay.getBearing().floatValue()); + sink.setBearing((float) groundOverlay.getBearing()); sink.setClickable(groundOverlay.getClickable()); sink.setImage(toBitmapDescriptor(groundOverlay.getImage(), assetManager, density, wrapper)); if (groundOverlay.getPosition() != null) { @@ -951,7 +866,7 @@ static Tile tileFromPigeon(Messages.PlatformTile tile) { * @param isCreatedWithBounds indicates if the GroundOverlay was created with bounds. * @return the converted PlatformGroundOverlay object. */ - static @NonNull Messages.PlatformGroundOverlay groundOverlayToPigeon( + static @NonNull PlatformGroundOverlay groundOverlayToPigeon( @NonNull GroundOverlay groundOverlay, @NonNull String groundOverlayId, boolean isCreatedWithBounds) { @@ -962,36 +877,36 @@ static Tile tileFromPigeon(Messages.PlatformTile tile) { // converted to format google maps uses (BitmapDescription), and the original // data is not stored on native code. Therefore placeholder image is used for // the image field. - Messages.PlatformBitmap dummyImage = - new Messages.PlatformBitmap.Builder() - .setBitmap( - new Messages.PlatformBitmapBytesMap.Builder() - .setByteData(new byte[] {0}) - .setImagePixelRatio(1.0) - .setBitmapScaling(Messages.PlatformMapBitmapScaling.NONE) - .build()) - .build(); - - Messages.PlatformGroundOverlay.Builder builder = - new Messages.PlatformGroundOverlay.Builder() - .setGroundOverlayId(groundOverlayId) - .setImage(dummyImage) - .setWidth((double) groundOverlay.getWidth()) - .setHeight((double) groundOverlay.getHeight()) - .setBearing((double) groundOverlay.getBearing()) - .setTransparency((double) groundOverlay.getTransparency()) - .setZIndex((long) groundOverlay.getZIndex()) - .setVisible(groundOverlay.isVisible()) - .setClickable(groundOverlay.isClickable()); - + PlatformBitmap dummyImage = + new PlatformBitmap( + new PlatformBitmapBytesMap( + new byte[] {0}, + PlatformMapBitmapScaling.NONE, + /* imagePixelRatio */ 1.0, /* width */ + null, /* height */ + null)); + + PlatformLatLngBounds bounds = null; + PlatformLatLng position = null; if (isCreatedWithBounds) { - builder.setBounds(Convert.latLngBoundsToPigeon(groundOverlay.getBounds())); + bounds = Convert.latLngBoundsToPigeon(groundOverlay.getBounds()); } else { - builder.setPosition(Convert.latLngToPigeon(groundOverlay.getPosition())); + position = Convert.latLngToPigeon(groundOverlay.getPosition()); } - builder.setAnchor(Convert.buildGroundOverlayAnchorForPigeon(groundOverlay)); - return builder.build(); + return new PlatformGroundOverlay( + groundOverlayId, + dummyImage, + position, + bounds, + (double) groundOverlay.getWidth(), + (double) groundOverlay.getHeight(), + Convert.buildGroundOverlayAnchorForPigeon(groundOverlay), + groundOverlay.getTransparency(), + groundOverlay.getBearing(), + (long) groundOverlay.getZIndex(), + groundOverlay.isVisible(), + groundOverlay.isClickable()); } /** @@ -1001,11 +916,10 @@ static Tile tileFromPigeon(Messages.PlatformTile tile) { * @return the PlatformDoublePair representing the anchor point. */ @VisibleForTesting - public static @NonNull Messages.PlatformDoublePair buildGroundOverlayAnchorForPigeon( + public static @NonNull PlatformDoublePair buildGroundOverlayAnchorForPigeon( @NonNull GroundOverlay groundOverlay) { - Messages.PlatformDoublePair.Builder anchorBuilder = new Messages.PlatformDoublePair.Builder(); - - // Position is overlays anchor point. Calculate normalized anchor point based on position and bounds. + // Position is overlays anchor point. Calculate normalized anchor point based on position and + // bounds. LatLng position = groundOverlay.getPosition(); LatLngBounds bounds = groundOverlay.getBounds(); @@ -1030,9 +944,7 @@ static Tile tileFromPigeon(Messages.PlatformTile tile) { - west) / width; - anchorBuilder.setX(normalizedLongitude); - anchorBuilder.setY(normalizedLatitude); - return anchorBuilder.build(); + return new PlatformDoublePair(/* x */ normalizedLongitude, /* y */ normalizedLatitude); } static class BitmapDescriptorFactoryWrapper { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapBuilder.java index 5a00a0ab95a3..0f2c9ed7ff44 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapBuilder.java @@ -12,25 +12,24 @@ import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLngBounds; import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.util.List; class GoogleMapBuilder implements GoogleMapOptionsSink { - private final GoogleMapOptions options = new GoogleMapOptions(); + private final @NonNull GoogleMapOptions options = new GoogleMapOptions(); private boolean trackCameraPosition = false; private boolean myLocationEnabled = false; private boolean myLocationButtonEnabled = false; private boolean indoorEnabled = true; private boolean trafficEnabled = false; private boolean buildingsEnabled = true; - private List initialMarkers; - private List initialClusterManagers; - private List initialPolygons; - private List initialPolylines; - private List initialCircles; - private List initialHeatmaps; - private List initialTileOverlays; - private List initialGroundOverlays; + private List initialMarkers; + private List initialClusterManagers; + private List initialPolygons; + private List initialPolylines; + private List initialCircles; + private List initialHeatmaps; + private List initialTileOverlays; + private List initialGroundOverlays; private Rect padding = new Rect(0, 0, 0, 0); private @Nullable String style; @@ -167,44 +166,42 @@ public void setMyLocationButtonEnabled(boolean myLocationButtonEnabled) { } @Override - public void setInitialMarkers(@NonNull List initialMarkers) { + public void setInitialMarkers(@NonNull List initialMarkers) { this.initialMarkers = initialMarkers; } @Override public void setInitialClusterManagers( - @NonNull List initialClusterManagers) { + @NonNull List initialClusterManagers) { this.initialClusterManagers = initialClusterManagers; } @Override - public void setInitialPolygons(@NonNull List initialPolygons) { + public void setInitialPolygons(@NonNull List initialPolygons) { this.initialPolygons = initialPolygons; } @Override - public void setInitialPolylines(@NonNull List initialPolylines) { + public void setInitialPolylines(@NonNull List initialPolylines) { this.initialPolylines = initialPolylines; } @Override - public void setInitialCircles(@NonNull List initialCircles) { + public void setInitialCircles(@NonNull List initialCircles) { this.initialCircles = initialCircles; } @Override - public void setInitialHeatmaps(@NonNull List initialHeatmaps) { + public void setInitialHeatmaps(@NonNull List initialHeatmaps) { this.initialHeatmaps = initialHeatmaps; } - public void setInitialTileOverlays( - @NonNull List initialTileOverlays) { + public void setInitialTileOverlays(@NonNull List initialTileOverlays) { this.initialTileOverlays = initialTileOverlays; } @Override - public void setInitialGroundOverlays( - @NonNull List initialGroundOverlays) { + public void setInitialGroundOverlays(@NonNull List initialGroundOverlays) { this.initialGroundOverlays = initialGroundOverlays; } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java index 8da755db70ed..273e0989cbfe 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java @@ -47,16 +47,15 @@ import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.platform.PlatformView; -import io.flutter.plugins.googlemaps.Messages.FlutterError; -import io.flutter.plugins.googlemaps.Messages.MapsApi; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; -import io.flutter.plugins.googlemaps.Messages.MapsInspectorApi; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Set; +import kotlin.Result; +import kotlin.Unit; +import kotlin.jvm.functions.Function1; +import org.jetbrains.annotations.NotNull; /** Controller of a single GoogleMaps MapView instance. */ class GoogleMapController @@ -88,7 +87,8 @@ class GoogleMapController private boolean buildingsEnabled = true; private boolean disposed = false; @VisibleForTesting final float density; - private @Nullable Messages.VoidResult mapReadyResult; + private @Nullable Function1, @NotNull Unit> + mapReadyCallback; private final Context context; private final LifecycleProvider lifecycleProvider; private final MarkersController markersController; @@ -101,14 +101,14 @@ class GoogleMapController private final GroundOverlaysController groundOverlaysController; private MarkerManager markerManager; private MarkerManager.Collection markerCollection; - private @Nullable List initialMarkers; - private @Nullable List initialClusterManagers; - private @Nullable List initialPolygons; - private @Nullable List initialPolylines; - private @Nullable List initialCircles; - private @Nullable List initialHeatmaps; - private @Nullable List initialTileOverlays; - private @Nullable List initialGroundOverlays; + private @Nullable List initialMarkers; + private @Nullable List initialClusterManagers; + private @Nullable List initialPolygons; + private @Nullable List initialPolylines; + private @Nullable List initialCircles; + private @Nullable List initialHeatmaps; + private @Nullable List initialTileOverlays; + private @Nullable List initialGroundOverlays; // Null except between initialization and onMapReady. private @Nullable String initialMapStyle; private boolean lastSetStyleSucceeded; @@ -128,8 +128,8 @@ class GoogleMapController this.density = context.getResources().getDisplayMetrics().density; this.binaryMessenger = binaryMessenger; flutterApi = new MapsCallbackApi(binaryMessenger, Integer.toString(id)); - MapsApi.setUp(binaryMessenger, Integer.toString(id), this); - MapsInspectorApi.setUp(binaryMessenger, Integer.toString(id), this); + MapsApi.Companion.setUp(binaryMessenger, this, Integer.toString(id)); + MapsInspectorApi.Companion.setUp(binaryMessenger, this, Integer.toString(id)); AssetManager assetManager = context.getAssets(); this.lifecycleProvider = lifecycleProvider; this.clusterManagersController = new ClusterManagersController(flutterApi, context, markerType); @@ -206,9 +206,9 @@ public void onMapReady(@NonNull GoogleMap googleMap) { this.googleMap.setTrafficEnabled(this.trafficEnabled); this.googleMap.setBuildingsEnabled(this.buildingsEnabled); installInvalidator(); - if (mapReadyResult != null) { - mapReadyResult.success(); - mapReadyResult = null; + if (mapReadyCallback != null) { + ResultUtilsKt.completeWithUnitSuccess(mapReadyCallback); + mapReadyCallback = null; } setGoogleMapListener(this); markerManager = new MarkerManager(googleMap); @@ -316,17 +316,17 @@ public void onSurfaceTextureUpdated(@NonNull SurfaceTexture surface) { @Override public void onMapClick(@NonNull LatLng latLng) { - flutterApi.onTap(Convert.latLngToPigeon(latLng), new NoOpVoidResult()); + flutterApi.onTap(Convert.latLngToPigeon(latLng), (Result result) -> Unit.INSTANCE); } @Override public void onMapLongClick(@NonNull LatLng latLng) { - flutterApi.onLongPress(Convert.latLngToPigeon(latLng), new NoOpVoidResult()); + flutterApi.onLongPress(Convert.latLngToPigeon(latLng), (Result result) -> Unit.INSTANCE); } @Override public void onCameraMoveStarted(int reason) { - flutterApi.onCameraMoveStarted(new NoOpVoidResult()); + flutterApi.onCameraMoveStarted((Result result) -> Unit.INSTANCE); } @Override @@ -340,13 +340,14 @@ public void onCameraMove() { return; } flutterApi.onCameraMove( - Convert.cameraPositionToPigeon(googleMap.getCameraPosition()), new NoOpVoidResult()); + Convert.cameraPositionToPigeon(googleMap.getCameraPosition()), + (Result result) -> Unit.INSTANCE); } @Override public void onCameraIdle() { clusterManagersController.onCameraIdle(); - flutterApi.onCameraIdle(new NoOpVoidResult()); + flutterApi.onCameraIdle((Result result) -> Unit.INSTANCE); } @Override @@ -395,8 +396,8 @@ public void dispose() { return; } disposed = true; - MapsApi.setUp(binaryMessenger, Integer.toString(id), null); - MapsInspectorApi.setUp(binaryMessenger, Integer.toString(id), null); + MapsApi.Companion.setUp(binaryMessenger, null, Integer.toString(id)); + MapsInspectorApi.Companion.setUp(binaryMessenger, null, Integer.toString(id)); setGoogleMapListener(null); setMarkerCollectionListener(null); setClusterItemClickListener(null); @@ -661,7 +662,7 @@ public void setZoomControlsEnabled(boolean zoomControlsEnabled) { } @Override - public void setInitialMarkers(@NonNull List initialMarkers) { + public void setInitialMarkers(@NonNull List initialMarkers) { this.initialMarkers = initialMarkers; if (googleMap != null) { updateInitialMarkers(); @@ -676,7 +677,7 @@ private void updateInitialMarkers() { @Override public void setInitialClusterManagers( - @NonNull List initialClusterManagers) { + @NonNull List initialClusterManagers) { this.initialClusterManagers = initialClusterManagers; if (googleMap != null) { updateInitialClusterManagers(); @@ -690,7 +691,7 @@ private void updateInitialClusterManagers() { } @Override - public void setInitialPolygons(@NonNull List initialPolygons) { + public void setInitialPolygons(@NonNull List initialPolygons) { this.initialPolygons = initialPolygons; if (googleMap != null) { updateInitialPolygons(); @@ -704,7 +705,7 @@ private void updateInitialPolygons() { } @Override - public void setInitialPolylines(@NonNull List initialPolylines) { + public void setInitialPolylines(@NonNull List initialPolylines) { this.initialPolylines = initialPolylines; if (googleMap != null) { updateInitialPolylines(); @@ -718,7 +719,7 @@ private void updateInitialPolylines() { } @Override - public void setInitialCircles(@NonNull List initialCircles) { + public void setInitialCircles(@NonNull List initialCircles) { this.initialCircles = initialCircles; if (googleMap != null) { updateInitialCircles(); @@ -726,7 +727,7 @@ public void setInitialCircles(@NonNull List initialCirc } @Override - public void setInitialHeatmaps(@NonNull List initialHeatmaps) { + public void setInitialHeatmaps(@NonNull List initialHeatmaps) { this.initialHeatmaps = initialHeatmaps; if (googleMap != null) { updateInitialHeatmaps(); @@ -746,8 +747,7 @@ private void updateInitialHeatmaps() { } @Override - public void setInitialTileOverlays( - @NonNull List initialTileOverlays) { + public void setInitialTileOverlays(@NonNull List initialTileOverlays) { this.initialTileOverlays = initialTileOverlays; if (googleMap != null) { updateInitialTileOverlays(); @@ -761,8 +761,7 @@ private void updateInitialTileOverlays() { } @Override - public void setInitialGroundOverlays( - @NonNull List initialGroundOverlays) { + public void setInitialGroundOverlays(@NonNull List initialGroundOverlays) { this.initialGroundOverlays = initialGroundOverlays; if (googleMap != null) { updateInitialGroundOverlays(); @@ -864,23 +863,24 @@ private boolean updateMapStyle(String style) { /** MapsApi implementation */ @Override - public void waitForMap(@NonNull Messages.VoidResult result) { + public void waitForMap( + @NonNull Function1, @NotNull Unit> callback) { if (googleMap == null) { - mapReadyResult = result; + mapReadyCallback = callback; } else { - result.success(); + ResultUtilsKt.completeWithUnitSuccess(callback); } } @Override - public void updateMapConfiguration(@NonNull Messages.PlatformMapConfiguration configuration) { + public void updateMapConfiguration(@NonNull PlatformMapConfiguration configuration) { Convert.interpretMapConfiguration(configuration, this); } @Override public void updateCircles( - @NonNull List toAdd, - @NonNull List toChange, + @NonNull List toAdd, + @NonNull List toChange, @NonNull List idsToRemove) { circlesController.addCircles(toAdd); circlesController.changeCircles(toChange); @@ -889,8 +889,8 @@ public void updateCircles( @Override public void updateHeatmaps( - @NonNull List toAdd, - @NonNull List toChange, + @NonNull List toAdd, + @NonNull List toChange, @NonNull List idsToRemove) { heatmapsController.addHeatmaps(toAdd); heatmapsController.changeHeatmaps(toChange); @@ -899,15 +899,15 @@ public void updateHeatmaps( @Override public void updateClusterManagers( - @NonNull List toAdd, @NonNull List idsToRemove) { + @NonNull List toAdd, @NonNull List idsToRemove) { clusterManagersController.addClusterManagers(toAdd); clusterManagersController.removeClusterManagers(idsToRemove); } @Override public void updateMarkers( - @NonNull List toAdd, - @NonNull List toChange, + @NonNull List toAdd, + @NonNull List toChange, @NonNull List idsToRemove) { markersController.addMarkers(toAdd); markersController.changeMarkers(toChange); @@ -916,8 +916,8 @@ public void updateMarkers( @Override public void updatePolygons( - @NonNull List toAdd, - @NonNull List toChange, + @NonNull List toAdd, + @NonNull List toChange, @NonNull List idsToRemove) { polygonsController.addPolygons(toAdd); polygonsController.changePolygons(toChange); @@ -926,8 +926,8 @@ public void updatePolygons( @Override public void updatePolylines( - @NonNull List toAdd, - @NonNull List toChange, + @NonNull List toAdd, + @NonNull List toChange, @NonNull List idsToRemove) { polylinesController.addPolylines(toAdd); polylinesController.changePolylines(toChange); @@ -936,8 +936,8 @@ public void updatePolylines( @Override public void updateTileOverlays( - @NonNull List toAdd, - @NonNull List toChange, + @NonNull List toAdd, + @NonNull List toChange, @NonNull List idsToRemove) { tileOverlaysController.addTileOverlays(toAdd); tileOverlaysController.changeTileOverlays(toChange); @@ -946,8 +946,8 @@ public void updateTileOverlays( @Override public void updateGroundOverlays( - @NonNull List toAdd, - @NonNull List toChange, + @NonNull List toAdd, + @NonNull List toChange, @NonNull List idsToRemove) { groundOverlaysController.addGroundOverlays(toAdd); groundOverlaysController.changeGroundOverlays(toChange); @@ -955,8 +955,7 @@ public void updateGroundOverlays( } @Override - public @NonNull Messages.PlatformPoint getScreenCoordinate( - @NonNull Messages.PlatformLatLng latLng) { + public @NonNull PlatformPoint getScreenCoordinate(@NonNull PlatformLatLng latLng) { if (googleMap == null) { throw new FlutterError( "GoogleMap uninitialized", @@ -969,8 +968,7 @@ public void updateGroundOverlays( } @Override - public @NonNull Messages.PlatformLatLng getLatLng( - @NonNull Messages.PlatformPoint screenCoordinate) { + public @NonNull PlatformLatLng getLatLng(@NonNull PlatformPoint screenCoordinate) { if (googleMap == null) { throw new FlutterError( "GoogleMap uninitialized", "getLatLng called prior to map initialization", null); @@ -981,7 +979,7 @@ public void updateGroundOverlays( } @Override - public @NonNull Messages.PlatformLatLngBounds getVisibleRegion() { + public @NonNull PlatformLatLngBounds getVisibleRegion() { if (googleMap == null) { throw new FlutterError( "GoogleMap uninitialized", "getVisibleRegion called prior to map initialization", null); @@ -991,7 +989,7 @@ public void updateGroundOverlays( } @Override - public void moveCamera(@NonNull Messages.PlatformCameraUpdate cameraUpdate) { + public void moveCamera(@NonNull PlatformCameraUpdate cameraUpdate) { if (googleMap == null) { throw new FlutterError( "GoogleMap uninitialized", "moveCamera called prior to map initialization", null); @@ -1001,7 +999,7 @@ public void moveCamera(@NonNull Messages.PlatformCameraUpdate cameraUpdate) { @Override public void animateCamera( - @NonNull Messages.PlatformCameraUpdate cameraUpdate, @Nullable Long durationMilliseconds) { + @NonNull PlatformCameraUpdate cameraUpdate, @Nullable Long durationMilliseconds) { if (googleMap == null) { throw new FlutterError( "GoogleMap uninitialized", "animateCamera called prior to map initialization", null); @@ -1015,7 +1013,7 @@ public void animateCamera( } @Override - public @NonNull Double getZoomLevel() { + public double getZoomLevel() { if (googleMap == null) { throw new FlutterError( "GoogleMap uninitialized", "getZoomLevel called prior to map initialization", null); @@ -1033,24 +1031,23 @@ public void hideInfoWindow(@NonNull String markerId) { markersController.hideMarkerInfoWindow(markerId); } - @NonNull @Override - public Boolean isInfoWindowShown(@NonNull String markerId) { + public boolean isInfoWindowShown(@NonNull String markerId) { return markersController.isInfoWindowShown(markerId); } @Override - public @NonNull Boolean setStyle(@NonNull String style) { + public boolean setStyle(@NonNull String style) { return updateMapStyle(style); } @Override - public @NonNull Boolean didLastStyleSucceed() { + public boolean didLastStyleSucceed() { return lastSetStyleSucceeded; } @Override - public @NonNull Boolean isAdvancedMarkersAvailable() { + public boolean isAdvancedMarkersAvailable() { if (googleMap == null) { throw new FlutterError( "GoogleMap uninitialized", @@ -1067,20 +1064,23 @@ public void clearTileCache(@NonNull String tileOverlayId) { } @Override - public void takeSnapshot(@NonNull Messages.Result result) { + public void takeSnapshot( + @NonNull Function1, Unit> callback) { if (googleMap == null) { - result.error(new FlutterError("GoogleMap uninitialized", "takeSnapshot", null)); + ResultUtilsKt.completeWithError( + callback, new FlutterError("GoogleMap uninitialized", "takeSnapshot", null)); } else { googleMap.snapshot( bitmap -> { if (bitmap == null) { - result.error(new FlutterError("Snapshot failure", "Unable to take snapshot", null)); + ResultUtilsKt.completeWithError( + callback, new FlutterError("Snapshot failure", "Unable to take snapshot", null)); } else { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); bitmap.recycle(); - result.success(byteArray); + ResultUtilsKt.completeWithValue(callback, byteArray); } }); } @@ -1088,37 +1088,37 @@ public void takeSnapshot(@NonNull Messages.Result result) { /** MapsInspectorApi implementation */ @Override - public @NonNull Boolean areBuildingsEnabled() { + public boolean areBuildingsEnabled() { return Objects.requireNonNull(googleMap).isBuildingsEnabled(); } @Override - public @NonNull Boolean areRotateGesturesEnabled() { + public boolean areRotateGesturesEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isRotateGesturesEnabled(); } @Override - public @NonNull Boolean areZoomControlsEnabled() { + public boolean areZoomControlsEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isZoomControlsEnabled(); } @Override - public @NonNull Boolean areScrollGesturesEnabled() { + public boolean areScrollGesturesEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isScrollGesturesEnabled(); } @Override - public @NonNull Boolean areTiltGesturesEnabled() { + public boolean areTiltGesturesEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isTiltGesturesEnabled(); } @Override - public @NonNull Boolean areZoomGesturesEnabled() { + public boolean areZoomGesturesEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isZoomGesturesEnabled(); } @Override - public @NonNull Boolean isCompassEnabled() { + public boolean isCompassEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isCompassEnabled(); } @@ -1128,42 +1128,40 @@ public Boolean isLiteModeEnabled() { } @Override - public @NonNull Boolean isMapToolbarEnabled() { + public boolean isMapToolbarEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isMapToolbarEnabled(); } @Override - public @NonNull Boolean isMyLocationButtonEnabled() { + public boolean isMyLocationButtonEnabled() { return Objects.requireNonNull(googleMap).getUiSettings().isMyLocationButtonEnabled(); } @Override - public @NonNull Boolean isTrafficEnabled() { + public boolean isTrafficEnabled() { return Objects.requireNonNull(googleMap).isTrafficEnabled(); } @Override - public @NonNull Messages.PlatformCameraPosition getCameraPosition() { + public @NonNull PlatformCameraPosition getCameraPosition() { return Convert.cameraPositionToPigeon(Objects.requireNonNull(googleMap).getCameraPosition()); } @Override - public @Nullable Messages.PlatformTileLayer getTileOverlayInfo(@NonNull String tileOverlayId) { + public @Nullable PlatformTileLayer getTileOverlayInfo(@NonNull String tileOverlayId) { TileOverlay tileOverlay = tileOverlaysController.getTileOverlay(tileOverlayId); if (tileOverlay == null) { return null; } - return new Messages.PlatformTileLayer.Builder() - .setFadeIn(tileOverlay.getFadeIn()) - .setTransparency((double) tileOverlay.getTransparency()) - .setZIndex((double) tileOverlay.getZIndex()) - .setVisible(tileOverlay.isVisible()) - .build(); + return new PlatformTileLayer( + tileOverlay.isVisible(), + tileOverlay.getFadeIn(), + tileOverlay.getTransparency(), + tileOverlay.getZIndex()); } @Override - public @Nullable Messages.PlatformGroundOverlay getGroundOverlayInfo( - @NonNull String groundOverlayId) { + public @Nullable PlatformGroundOverlay getGroundOverlayInfo(@NonNull String groundOverlayId) { GroundOverlay groundOverlay = groundOverlaysController.getGroundOverlay(groundOverlayId); if (groundOverlay == null) { return null; @@ -1176,18 +1174,17 @@ public Boolean isLiteModeEnabled() { } @Override - public @NonNull Messages.PlatformZoomRange getZoomRange() { - return new Messages.PlatformZoomRange.Builder() - .setMin((double) Objects.requireNonNull(googleMap).getMinZoomLevel()) - .setMax((double) Objects.requireNonNull(googleMap).getMaxZoomLevel()) - .build(); + public @NonNull PlatformZoomRange getZoomRange() { + return new PlatformZoomRange( + (double) Objects.requireNonNull(googleMap).getMinZoomLevel(), + (double) Objects.requireNonNull(googleMap).getMaxZoomLevel()); } @Override - public @NonNull List getClusters(@NonNull String clusterManagerId) { + public @NonNull List getClusters(@NonNull String clusterManagerId) { Set> clusters = clusterManagersController.getClustersWithClusterManagerId(clusterManagerId); - List data = new ArrayList<>(clusters.size()); + List data = new ArrayList<>(clusters.size()); for (Cluster cluster : clusters) { data.add(clusterToPigeon(clusterManagerId, cluster)); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java index 424140ce4d9a..ddd9fa95ed7c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java @@ -21,7 +21,7 @@ public class GoogleMapFactory extends PlatformViewFactory { GoogleMapFactory( BinaryMessenger binaryMessenger, Context context, LifecycleProvider lifecycleProvider) { - super(Messages.MapsApi.getCodec()); + super(MapsApi.Companion.getCodec()); this.binaryMessenger = binaryMessenger; this.lifecycleProvider = lifecycleProvider; @@ -31,11 +31,11 @@ public class GoogleMapFactory extends PlatformViewFactory { @Override @NonNull public PlatformView create(@NonNull Context context, int id, @Nullable Object args) { - final Messages.PlatformMapViewCreationParams params = - Objects.requireNonNull((Messages.PlatformMapViewCreationParams) args); + final PlatformMapViewCreationParams params = + Objects.requireNonNull((PlatformMapViewCreationParams) args); final GoogleMapBuilder builder = new GoogleMapBuilder(); - final Messages.PlatformMapConfiguration mapConfig = params.getMapConfiguration(); + final PlatformMapConfiguration mapConfig = params.getMapConfiguration(); Convert.interpretMapConfiguration(mapConfig, builder); CameraPosition position = Convert.cameraPositionFromPigeon(params.getInitialCameraPosition()); builder.setInitialCameraPosition(position); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java index da236c287801..3e50f5cb7c9f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java @@ -13,33 +13,41 @@ import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.OnMapsSdkInitializedCallback; import io.flutter.plugin.common.BinaryMessenger; +import kotlin.Result; +import kotlin.Unit; +import kotlin.jvm.functions.Function1; +import org.jetbrains.annotations.NotNull; /** GoogleMaps initializer used to initialize the Google Maps SDK with preferred settings. */ -final class GoogleMapInitializer - implements OnMapsSdkInitializedCallback, Messages.MapsInitializerApi { +final class GoogleMapInitializer implements OnMapsSdkInitializedCallback, MapsInitializerApi { private static final String TAG = "GoogleMapInitializer"; private final Context context; - private static Messages.Result initializationResult; + private static @Nullable Function1< + ? super @NotNull Result, @NotNull Unit> + initializationCallback; private boolean rendererInitialized = false; GoogleMapInitializer(Context context, BinaryMessenger binaryMessenger) { this.context = context; - Messages.MapsInitializerApi.setUp(binaryMessenger, this); + MapsInitializerApi.Companion.setUp(binaryMessenger, this); } @Override public void initializeWithPreferredRenderer( - @Nullable Messages.PlatformRendererType type, - @NonNull Messages.Result result) { - if (rendererInitialized || initializationResult != null) { - result.error( - new Messages.FlutterError( + @Nullable PlatformRendererType type, + @NonNull + Function1, @NotNull Unit> + callback) { + if (rendererInitialized || initializationCallback != null) { + ResultUtilsKt.completeWithError( + callback, + new FlutterError( "Renderer already initialized", "Renderer initialization called multiple times", null)); } else { - initializationResult = result; + initializationCallback = callback; initializeWithRendererRequest(Convert.toMapRendererType(type)); } } @@ -58,7 +66,7 @@ public void warmup() { mv.onDestroy(); Log.i(TAG, "Maps warmup complete."); } catch (Exception e) { - throw new Messages.FlutterError("Could not warm up", e.toString(), null); + throw new FlutterError("Could not warm up", e.toString(), null); } } @@ -77,22 +85,23 @@ public void initializeWithRendererRequest(@Nullable MapsInitializer.Renderer ren @Override public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { rendererInitialized = true; - if (initializationResult != null) { + if (initializationCallback != null) { switch (renderer) { case LATEST: - initializationResult.success(Messages.PlatformRendererType.LATEST); + ResultUtilsKt.completeWithValue(initializationCallback, PlatformRendererType.LATEST); break; case LEGACY: - initializationResult.success(Messages.PlatformRendererType.LEGACY); + ResultUtilsKt.completeWithValue(initializationCallback, PlatformRendererType.LEGACY); break; default: - initializationResult.error( - new Messages.FlutterError( + ResultUtilsKt.completeWithError( + initializationCallback, + new FlutterError( "Unknown renderer type", "Initialized with unknown renderer type", renderer.name())); } - initializationResult = null; + initializationCallback = null; } } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapOptionsSink.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapOptionsSink.java index 698473bf1f42..055c5dfec212 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapOptionsSink.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapOptionsSink.java @@ -47,23 +47,21 @@ interface GoogleMapOptionsSink { void setBuildingsEnabled(boolean buildingsEnabled); - void setInitialMarkers(@NonNull List initialMarkers); + void setInitialMarkers(@NonNull List initialMarkers); - void setInitialClusterManagers( - @NonNull List initialClusterManagers); + void setInitialClusterManagers(@NonNull List initialClusterManagers); - void setInitialPolygons(@NonNull List initialPolygons); + void setInitialPolygons(@NonNull List initialPolygons); - void setInitialPolylines(@NonNull List initialPolylines); + void setInitialPolylines(@NonNull List initialPolylines); - void setInitialCircles(@NonNull List initialCircles); + void setInitialCircles(@NonNull List initialCircles); - void setInitialHeatmaps(@NonNull List initialHeatmaps); + void setInitialHeatmaps(@NonNull List initialHeatmaps); - void setInitialTileOverlays(@NonNull List initialTileOverlays); + void setInitialTileOverlays(@NonNull List initialTileOverlays); - void setInitialGroundOverlays( - @NonNull List initialGroundOverlays); + void setInitialGroundOverlays(@NonNull List initialGroundOverlays); void setMapStyle(@Nullable String style); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java index 0836e79e9cba..6c53be54f1d1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapsPlugin.java @@ -4,15 +4,9 @@ package io.flutter.plugins.googlemaps; -import android.app.Activity; -import android.app.Application.ActivityLifecycleCallbacks; -import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.lifecycle.Lifecycle; -import androidx.lifecycle.Lifecycle.Event; -import androidx.lifecycle.LifecycleOwner; -import androidx.lifecycle.LifecycleRegistry; import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.embedding.engine.plugins.activity.ActivityAware; import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; @@ -41,15 +35,7 @@ public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { .registerViewFactory( VIEW_TYPE, new GoogleMapFactory( - binding.getBinaryMessenger(), - binding.getApplicationContext(), - new LifecycleProvider() { - @Nullable - @Override - public Lifecycle getLifecycle() { - return lifecycle; - } - })); + binding.getBinaryMessenger(), binding.getApplicationContext(), () -> lifecycle)); } @Override @@ -76,80 +62,4 @@ public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBindin public void onDetachedFromActivityForConfigChanges() { onDetachedFromActivity(); } - - /** - * This class provides a {@link LifecycleOwner} for the activity driven by {@link - * ActivityLifecycleCallbacks}. - * - *

This is used in the case where a direct Lifecycle/Owner is not available. - */ - private static final class ProxyLifecycleProvider - implements ActivityLifecycleCallbacks, LifecycleOwner, LifecycleProvider { - - private final LifecycleRegistry lifecycle = new LifecycleRegistry(this); - private final int registrarActivityHashCode; - - ProxyLifecycleProvider(Activity activity) { - this.registrarActivityHashCode = activity.hashCode(); - activity.getApplication().registerActivityLifecycleCallbacks(this); - } - - @Override - public void onActivityCreated(Activity activity, Bundle savedInstanceState) { - if (activity.hashCode() != registrarActivityHashCode) { - return; - } - lifecycle.handleLifecycleEvent(Event.ON_CREATE); - } - - @Override - public void onActivityStarted(Activity activity) { - if (activity.hashCode() != registrarActivityHashCode) { - return; - } - lifecycle.handleLifecycleEvent(Event.ON_START); - } - - @Override - public void onActivityResumed(Activity activity) { - if (activity.hashCode() != registrarActivityHashCode) { - return; - } - lifecycle.handleLifecycleEvent(Event.ON_RESUME); - } - - @Override - public void onActivityPaused(Activity activity) { - if (activity.hashCode() != registrarActivityHashCode) { - return; - } - lifecycle.handleLifecycleEvent(Event.ON_PAUSE); - } - - @Override - public void onActivityStopped(Activity activity) { - if (activity.hashCode() != registrarActivityHashCode) { - return; - } - lifecycle.handleLifecycleEvent(Event.ON_STOP); - } - - @Override - public void onActivitySaveInstanceState(Activity activity, Bundle outState) {} - - @Override - public void onActivityDestroyed(Activity activity) { - if (activity.hashCode() != registrarActivityHashCode) { - return; - } - activity.getApplication().unregisterActivityLifecycleCallbacks(this); - lifecycle.handleLifecycleEvent(Event.ON_DESTROY); - } - - @NonNull - @Override - public Lifecycle getLifecycle() { - return lifecycle; - } - } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlayBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlayBuilder.java index d916488177c9..e27bddce6416 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlayBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlayBuilder.java @@ -13,7 +13,7 @@ class GroundOverlayBuilder implements GroundOverlaySink { - private final GroundOverlayOptions groundOverlayOptions; + private final @NonNull GroundOverlayOptions groundOverlayOptions; GroundOverlayBuilder() { this.groundOverlayOptions = new GroundOverlayOptions(); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlaysController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlaysController.java index 21250a07592d..cbabe2f526f1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlaysController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GroundOverlaysController.java @@ -11,10 +11,11 @@ import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.GroundOverlay; import com.google.android.gms.maps.model.GroundOverlayOptions; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; import java.util.HashMap; import java.util.List; import java.util.Map; +import kotlin.Result; +import kotlin.Unit; class GroundOverlaysController { private final Map groundOverlayIdToController; @@ -48,14 +49,14 @@ void setGoogleMap(GoogleMap googleMap) { this.googleMap = googleMap; } - void addGroundOverlays(@NonNull List groundOverlaysToAdd) { - for (Messages.PlatformGroundOverlay groundOverlayToAdd : groundOverlaysToAdd) { + void addGroundOverlays(@NonNull List groundOverlaysToAdd) { + for (PlatformGroundOverlay groundOverlayToAdd : groundOverlaysToAdd) { addGroundOverlay(groundOverlayToAdd); } } - void changeGroundOverlays(@NonNull List groundOverlaysToChange) { - for (Messages.PlatformGroundOverlay groundOverlayToChange : groundOverlaysToChange) { + void changeGroundOverlays(@NonNull List groundOverlaysToChange) { + for (PlatformGroundOverlay groundOverlayToChange : groundOverlaysToChange) { changeGroundOverlay(groundOverlayToChange); } } @@ -76,7 +77,7 @@ GroundOverlay getGroundOverlay(@NonNull String groundOverlayId) { return groundOverlayController.getGroundOverlay(); } - private void addGroundOverlay(@NonNull Messages.PlatformGroundOverlay platformGroundOverlay) { + private void addGroundOverlay(@NonNull PlatformGroundOverlay platformGroundOverlay) { GroundOverlayBuilder groundOverlayOptionsBuilder = new GroundOverlayBuilder(); String groundOverlayId = Convert.interpretGroundOverlayOptions( @@ -95,7 +96,7 @@ private void addGroundOverlay(@NonNull Messages.PlatformGroundOverlay platformGr } } - private void changeGroundOverlay(@NonNull Messages.PlatformGroundOverlay platformGroundOverlay) { + private void changeGroundOverlay(@NonNull PlatformGroundOverlay platformGroundOverlay) { String groundOverlayId = platformGroundOverlay.getGroundOverlayId(); GroundOverlayController groundOverlayController = groundOverlayIdToController.get(groundOverlayId); @@ -126,7 +127,7 @@ void onGroundOverlayTap(@NonNull String googleGroundOverlayId) { if (groundOverlayId == null) { return; } - flutterApi.onGroundOverlayTap(groundOverlayId, new NoOpVoidResult()); + flutterApi.onGroundOverlayTap(groundOverlayId, (Result result) -> Unit.INSTANCE); } boolean isCreatedWithBounds(@NonNull String groundOverlayId) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapBuilder.java index f72378c19c8a..92bf4fcdb4bb 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapBuilder.java @@ -12,7 +12,7 @@ /** Builder of a single Heatmap on the map. */ public class HeatmapBuilder implements HeatmapOptionsSink { - private final HeatmapTileProvider.Builder heatmapOptions; + private final @NonNull HeatmapTileProvider.Builder heatmapOptions; /** Construct a HeatmapBuilder. */ HeatmapBuilder() { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java index 2f8f45ca6b52..da59a5ac5da9 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/HeatmapsController.java @@ -18,6 +18,7 @@ public class HeatmapsController { /** Mapping from Heatmap ID to HeatmapController. */ private final Map heatmapIdToController; + /** The GoogleMap to which the heatmaps are added. */ private GoogleMap googleMap; @@ -32,8 +33,8 @@ void setGoogleMap(GoogleMap googleMap) { } /** Adds heatmaps to the map. */ - void addHeatmaps(@NonNull List heatmapsToAdd) { - for (Messages.PlatformHeatmap heatmapToAdd : heatmapsToAdd) { + void addHeatmaps(@NonNull List heatmapsToAdd) { + for (PlatformHeatmap heatmapToAdd : heatmapsToAdd) { HeatmapBuilder heatmapBuilder = new HeatmapBuilder(); String heatmapId = Convert.interpretHeatmapOptions(heatmapToAdd, heatmapBuilder); HeatmapTileProvider options = buildHeatmap(heatmapBuilder); @@ -42,8 +43,8 @@ void addHeatmaps(@NonNull List heatmapsToAdd) { } /** Updates the given heatmaps on the map. */ - void changeHeatmaps(@NonNull List heatmapsToChange) { - for (Messages.PlatformHeatmap heatmapToChange : heatmapsToChange) { + void changeHeatmaps(@NonNull List heatmapsToChange) { + for (PlatformHeatmap heatmapToChange : heatmapsToChange) { String heatmapId = heatmapToChange.getHeatmapId(); HeatmapController heatmapController = heatmapIdToController.get(heatmapId); if (heatmapController != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkerBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkerBuilder.java index 53654a220805..21923095f47c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkerBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkerBuilder.java @@ -11,13 +11,12 @@ import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.google.maps.android.clustering.ClusterItem; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; class MarkerBuilder implements MarkerOptionsSink, ClusterItem { - private final MarkerOptions markerOptions; - @Nullable private final AdvancedMarkerOptions advancedMarkerOptions; - private String clusterManagerId; - private String markerId; + private final @NonNull MarkerOptions markerOptions; + private final @Nullable AdvancedMarkerOptions advancedMarkerOptions; + private final String clusterManagerId; + private final String markerId; private boolean consumeTapEvents; MarkerBuilder(String markerId, String clusterManagerId, @NonNull PlatformMarkerType markerType) { @@ -138,7 +137,7 @@ public void setCollisionBehavior(@AdvancedMarkerOptions.CollisionBehavior int co } @Override - public LatLng getPosition() { + public @NonNull LatLng getPosition() { return markerOptions.getPosition(); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java index 68550f3daee9..154612428e6e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java @@ -10,13 +10,13 @@ import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.maps.android.collections.MarkerManager; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import kotlin.Result; +import kotlin.Unit; class MarkersController { private final HashMap markerIdToMarkerBuilder; @@ -28,7 +28,7 @@ class MarkersController { private final AssetManager assetManager; private final float density; private final Convert.BitmapDescriptorFactoryWrapper bitmapDescriptorFactoryWrapper; - private @NonNull PlatformMarkerType markerType; + private final @NonNull PlatformMarkerType markerType; MarkersController( @NonNull MapsCallbackApi flutterApi, @@ -52,12 +52,12 @@ void setCollection(MarkerManager.Collection markerCollection) { this.markerCollection = markerCollection; } - void addMarkers(@NonNull List markersToAdd) { + void addMarkers(@NonNull List markersToAdd) { // Group markers by cluster manager ID for batch operations Map> markersByCluster = new HashMap<>(); List nonClusteredMarkers = new ArrayList<>(); - for (Messages.PlatformMarker markerToAdd : markersToAdd) { + for (PlatformMarker markerToAdd : markersToAdd) { String markerId = markerToAdd.getMarkerId(); String clusterManagerId = markerToAdd.getClusterManagerId(); MarkerBuilder markerBuilder = new MarkerBuilder(markerId, clusterManagerId, markerType); @@ -87,12 +87,12 @@ void addMarkers(@NonNull List markersToAdd) { } } - void changeMarkers(@NonNull List markersToChange) { + void changeMarkers(@NonNull List markersToChange) { // Collect markers that need cluster manager changes for batch processing Map> markersToAddByCluster = new HashMap<>(); Map> markersToRemoveByCluster = new HashMap<>(); - for (Messages.PlatformMarker markerToChange : markersToChange) { + for (PlatformMarker markerToChange : markersToChange) { String markerId = markerToChange.getMarkerId(); MarkerBuilder markerBuilder = markerIdToMarkerBuilder.get(markerId); if (markerBuilder == null) { @@ -234,7 +234,7 @@ private void removeMarker(String markerId) { void showMarkerInfoWindow(String markerId) { MarkerController markerController = markerIdToController.get(markerId); if (markerController == null) { - throw new Messages.FlutterError( + throw new FlutterError( "Invalid markerId", "showInfoWindow called with invalid markerId", null); } markerController.showInfoWindow(); @@ -243,7 +243,7 @@ void showMarkerInfoWindow(String markerId) { void hideMarkerInfoWindow(String markerId) { MarkerController markerController = markerIdToController.get(markerId); if (markerController == null) { - throw new Messages.FlutterError( + throw new FlutterError( "Invalid markerId", "hideInfoWindow called with invalid markerId", null); } markerController.hideInfoWindow(); @@ -252,7 +252,7 @@ void hideMarkerInfoWindow(String markerId) { boolean isInfoWindowShown(String markerId) { MarkerController markerController = markerIdToController.get(markerId); if (markerController == null) { - throw new Messages.FlutterError( + throw new FlutterError( "Invalid markerId", "isInfoWindowShown called with invalid markerId", null); } return markerController.isInfoWindowShown(); @@ -267,7 +267,7 @@ boolean onMapsMarkerTap(String googleMarkerId) { } boolean onMarkerTap(String markerId) { - flutterApi.onMarkerTap(markerId, new NoOpVoidResult()); + flutterApi.onMarkerTap(markerId, (Result result) -> Unit.INSTANCE); MarkerController markerController = markerIdToController.get(markerId); if (markerController != null) { return markerController.consumeTapEvents(); @@ -280,7 +280,8 @@ void onMarkerDragStart(String googleMarkerId, LatLng latLng) { if (markerId == null) { return; } - flutterApi.onMarkerDragStart(markerId, Convert.latLngToPigeon(latLng), new NoOpVoidResult()); + flutterApi.onMarkerDragStart( + markerId, Convert.latLngToPigeon(latLng), (Result result) -> Unit.INSTANCE); } void onMarkerDrag(String googleMarkerId, LatLng latLng) { @@ -288,7 +289,8 @@ void onMarkerDrag(String googleMarkerId, LatLng latLng) { if (markerId == null) { return; } - flutterApi.onMarkerDrag(markerId, Convert.latLngToPigeon(latLng), new NoOpVoidResult()); + flutterApi.onMarkerDrag( + markerId, Convert.latLngToPigeon(latLng), (Result result) -> Unit.INSTANCE); } void onMarkerDragEnd(String googleMarkerId, LatLng latLng) { @@ -296,7 +298,8 @@ void onMarkerDragEnd(String googleMarkerId, LatLng latLng) { if (markerId == null) { return; } - flutterApi.onMarkerDragEnd(markerId, Convert.latLngToPigeon(latLng), new NoOpVoidResult()); + flutterApi.onMarkerDragEnd( + markerId, Convert.latLngToPigeon(latLng), (Result result) -> Unit.INSTANCE); } void onInfoWindowTap(String googleMarkerId) { @@ -304,7 +307,7 @@ void onInfoWindowTap(String googleMarkerId) { if (markerId == null) { return; } - flutterApi.onInfoWindowTap(markerId, new NoOpVoidResult()); + flutterApi.onInfoWindowTap(markerId, (Result result) -> Unit.INSTANCE); } /** @@ -312,7 +315,7 @@ void onInfoWindowTap(String googleMarkerId) { * directly. */ void onClusterItemInfoWindowTap(String markerId) { - flutterApi.onInfoWindowTap(markerId, new NoOpVoidResult()); + flutterApi.onInfoWindowTap(markerId, (Result result) -> Unit.INSTANCE); } /** @@ -326,7 +329,7 @@ public void onClusterItemRendered(MarkerBuilder markerBuilder, Marker marker) { } } - private void addMarker(@NonNull Messages.PlatformMarker marker) { + private void addMarker(@NonNull PlatformMarker marker) { String markerId = marker.getMarkerId(); String clusterManagerId = marker.getClusterManagerId(); MarkerBuilder markerBuilder = new MarkerBuilder(markerId, clusterManagerId, markerType); @@ -367,7 +370,7 @@ private void createControllerForMarker(String markerId, Marker marker, boolean c googleMapsMarkerIdToDartMarkerId.put(marker.getId(), markerId); } - private void changeMarker(@NonNull Messages.PlatformMarker marker) { + private void changeMarker(@NonNull PlatformMarker marker) { String markerId = marker.getMarkerId(); MarkerBuilder markerBuilder = markerIdToMarkerBuilder.get(markerId); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java deleted file mode 100644 index 16c91b0196fe..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java +++ /dev/null @@ -1,8985 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.5), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -package io.flutter.plugins.googlemaps; - -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.CLASS; - -import android.util.Log; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MessageCodec; -import io.flutter.plugin.common.StandardMessageCodec; -import java.io.ByteArrayOutputStream; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -/** Generated class from Pigeon. */ -@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) -public class Messages { - - /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ - public static class FlutterError extends RuntimeException { - - /** The error code. */ - public final String code; - - /** The error details. Must be a datatype supported by the api codec. */ - public final Object details; - - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { - super(message); - this.code = code; - this.details = details; - } - } - - @NonNull - protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList<>(3); - if (exception instanceof FlutterError) { - FlutterError error = (FlutterError) exception; - errorList.add(error.code); - errorList.add(error.getMessage()); - errorList.add(error.details); - } else { - errorList.add(exception.toString()); - errorList.add(exception.getClass().getSimpleName()); - errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); - } - return errorList; - } - - @NonNull - protected static FlutterError createConnectionError(@NonNull String channelName) { - return new FlutterError( - "channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); - } - - @Target(METHOD) - @Retention(CLASS) - @interface CanIgnoreReturnValue {} - - /** Pigeon equivalent of MapType */ - public enum PlatformMapType { - NONE(0), - NORMAL(1), - SATELLITE(2), - TERRAIN(3), - HYBRID(4); - - final int index; - - PlatformMapType(final int index) { - this.index = index; - } - } - - public enum PlatformRendererType { - LEGACY(0), - LATEST(1); - - final int index; - - PlatformRendererType(final int index) { - this.index = index; - } - } - - public enum PlatformMarkerCollisionBehavior { - REQUIRED_DISPLAY(0), - OPTIONAL_AND_HIDES_LOWER_PRIORITY(1), - REQUIRED_AND_HIDES_OPTIONAL(2); - - final int index; - - PlatformMarkerCollisionBehavior(final int index) { - this.index = index; - } - } - - /** Join types for polyline joints. */ - public enum PlatformJointType { - MITERED(0), - BEVEL(1), - ROUND(2); - - final int index; - - PlatformJointType(final int index) { - this.index = index; - } - } - - /** - * Enumeration of possible types of PlatformCap, corresponding to the subclasses of Cap in the - * Google Maps Android SDK. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/Cap. - */ - public enum PlatformCapType { - BUTT_CAP(0), - ROUND_CAP(1), - SQUARE_CAP(2), - CUSTOM_CAP(3); - - final int index; - - PlatformCapType(final int index) { - this.index = index; - } - } - - /** Enumeration of possible types for PatternItem. */ - public enum PlatformPatternItemType { - DOT(0), - DASH(1), - GAP(2); - - final int index; - - PlatformPatternItemType(final int index) { - this.index = index; - } - } - - public enum PlatformMarkerType { - MARKER(0), - ADVANCED_MARKER(1); - - final int index; - - PlatformMarkerType(final int index) { - this.index = index; - } - } - - /** Pigeon equivalent of [MapBitmapScaling]. */ - public enum PlatformMapBitmapScaling { - AUTO(0), - NONE(1); - - final int index; - - PlatformMapBitmapScaling(final int index) { - this.index = index; - } - } - - /** - * Pigeon representatation of a CameraPosition. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraPosition { - private @NonNull Double bearing; - - public @NonNull Double getBearing() { - return bearing; - } - - public void setBearing(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bearing\" is null."); - } - this.bearing = setterArg; - } - - private @NonNull PlatformLatLng target; - - public @NonNull PlatformLatLng getTarget() { - return target; - } - - public void setTarget(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"target\" is null."); - } - this.target = setterArg; - } - - private @NonNull Double tilt; - - public @NonNull Double getTilt() { - return tilt; - } - - public void setTilt(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"tilt\" is null."); - } - this.tilt = setterArg; - } - - private @NonNull Double zoom; - - public @NonNull Double getZoom() { - return zoom; - } - - public void setZoom(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zoom\" is null."); - } - this.zoom = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraPosition() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraPosition that = (PlatformCameraPosition) o; - return bearing.equals(that.bearing) - && target.equals(that.target) - && tilt.equals(that.tilt) - && zoom.equals(that.zoom); - } - - @Override - public int hashCode() { - return Objects.hash(bearing, target, tilt, zoom); - } - - public static final class Builder { - - private @Nullable Double bearing; - - @CanIgnoreReturnValue - public @NonNull Builder setBearing(@NonNull Double setterArg) { - this.bearing = setterArg; - return this; - } - - private @Nullable PlatformLatLng target; - - @CanIgnoreReturnValue - public @NonNull Builder setTarget(@NonNull PlatformLatLng setterArg) { - this.target = setterArg; - return this; - } - - private @Nullable Double tilt; - - @CanIgnoreReturnValue - public @NonNull Builder setTilt(@NonNull Double setterArg) { - this.tilt = setterArg; - return this; - } - - private @Nullable Double zoom; - - @CanIgnoreReturnValue - public @NonNull Builder setZoom(@NonNull Double setterArg) { - this.zoom = setterArg; - return this; - } - - public @NonNull PlatformCameraPosition build() { - PlatformCameraPosition pigeonReturn = new PlatformCameraPosition(); - pigeonReturn.setBearing(bearing); - pigeonReturn.setTarget(target); - pigeonReturn.setTilt(tilt); - pigeonReturn.setZoom(zoom); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(bearing); - toListResult.add(target); - toListResult.add(tilt); - toListResult.add(zoom); - return toListResult; - } - - static @NonNull PlatformCameraPosition fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCameraPosition pigeonResult = new PlatformCameraPosition(); - Object bearing = pigeonVar_list.get(0); - pigeonResult.setBearing((Double) bearing); - Object target = pigeonVar_list.get(1); - pigeonResult.setTarget((PlatformLatLng) target); - Object tilt = pigeonVar_list.get(2); - pigeonResult.setTilt((Double) tilt); - Object zoom = pigeonVar_list.get(3); - pigeonResult.setZoom((Double) zoom); - return pigeonResult; - } - } - - /** - * Pigeon representation of a CameraUpdate. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdate { - /** - * This Object shall be any of the below classes prefixed with PlatformCameraUpdate. Each such - * class represents a different type of camera update, and each holds a different set of data, - * preventing the use of a single unified class. Pigeon does not support inheritance, which - * prevents a more strict type bound. See https://github.com/flutter/flutter/issues/117819. - */ - private @NonNull Object cameraUpdate; - - public @NonNull Object getCameraUpdate() { - return cameraUpdate; - } - - public void setCameraUpdate(@NonNull Object setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"cameraUpdate\" is null."); - } - this.cameraUpdate = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdate() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdate that = (PlatformCameraUpdate) o; - return cameraUpdate.equals(that.cameraUpdate); - } - - @Override - public int hashCode() { - return Objects.hash(cameraUpdate); - } - - public static final class Builder { - - private @Nullable Object cameraUpdate; - - @CanIgnoreReturnValue - public @NonNull Builder setCameraUpdate(@NonNull Object setterArg) { - this.cameraUpdate = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdate build() { - PlatformCameraUpdate pigeonReturn = new PlatformCameraUpdate(); - pigeonReturn.setCameraUpdate(cameraUpdate); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(cameraUpdate); - return toListResult; - } - - static @NonNull PlatformCameraUpdate fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdate pigeonResult = new PlatformCameraUpdate(); - Object cameraUpdate = pigeonVar_list.get(0); - pigeonResult.setCameraUpdate(cameraUpdate); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of NewCameraPosition - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateNewCameraPosition { - private @NonNull PlatformCameraPosition cameraPosition; - - public @NonNull PlatformCameraPosition getCameraPosition() { - return cameraPosition; - } - - public void setCameraPosition(@NonNull PlatformCameraPosition setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"cameraPosition\" is null."); - } - this.cameraPosition = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateNewCameraPosition() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateNewCameraPosition that = (PlatformCameraUpdateNewCameraPosition) o; - return cameraPosition.equals(that.cameraPosition); - } - - @Override - public int hashCode() { - return Objects.hash(cameraPosition); - } - - public static final class Builder { - - private @Nullable PlatformCameraPosition cameraPosition; - - @CanIgnoreReturnValue - public @NonNull Builder setCameraPosition(@NonNull PlatformCameraPosition setterArg) { - this.cameraPosition = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateNewCameraPosition build() { - PlatformCameraUpdateNewCameraPosition pigeonReturn = - new PlatformCameraUpdateNewCameraPosition(); - pigeonReturn.setCameraPosition(cameraPosition); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(cameraPosition); - return toListResult; - } - - static @NonNull PlatformCameraUpdateNewCameraPosition fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateNewCameraPosition pigeonResult = - new PlatformCameraUpdateNewCameraPosition(); - Object cameraPosition = pigeonVar_list.get(0); - pigeonResult.setCameraPosition((PlatformCameraPosition) cameraPosition); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of NewLatLng - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateNewLatLng { - private @NonNull PlatformLatLng latLng; - - public @NonNull PlatformLatLng getLatLng() { - return latLng; - } - - public void setLatLng(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"latLng\" is null."); - } - this.latLng = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateNewLatLng() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateNewLatLng that = (PlatformCameraUpdateNewLatLng) o; - return latLng.equals(that.latLng); - } - - @Override - public int hashCode() { - return Objects.hash(latLng); - } - - public static final class Builder { - - private @Nullable PlatformLatLng latLng; - - @CanIgnoreReturnValue - public @NonNull Builder setLatLng(@NonNull PlatformLatLng setterArg) { - this.latLng = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateNewLatLng build() { - PlatformCameraUpdateNewLatLng pigeonReturn = new PlatformCameraUpdateNewLatLng(); - pigeonReturn.setLatLng(latLng); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(latLng); - return toListResult; - } - - static @NonNull PlatformCameraUpdateNewLatLng fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateNewLatLng pigeonResult = new PlatformCameraUpdateNewLatLng(); - Object latLng = pigeonVar_list.get(0); - pigeonResult.setLatLng((PlatformLatLng) latLng); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of NewLatLngBounds - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateNewLatLngBounds { - private @NonNull PlatformLatLngBounds bounds; - - public @NonNull PlatformLatLngBounds getBounds() { - return bounds; - } - - public void setBounds(@NonNull PlatformLatLngBounds setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bounds\" is null."); - } - this.bounds = setterArg; - } - - private @NonNull Double padding; - - public @NonNull Double getPadding() { - return padding; - } - - public void setPadding(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"padding\" is null."); - } - this.padding = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateNewLatLngBounds() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateNewLatLngBounds that = (PlatformCameraUpdateNewLatLngBounds) o; - return bounds.equals(that.bounds) && padding.equals(that.padding); - } - - @Override - public int hashCode() { - return Objects.hash(bounds, padding); - } - - public static final class Builder { - - private @Nullable PlatformLatLngBounds bounds; - - @CanIgnoreReturnValue - public @NonNull Builder setBounds(@NonNull PlatformLatLngBounds setterArg) { - this.bounds = setterArg; - return this; - } - - private @Nullable Double padding; - - @CanIgnoreReturnValue - public @NonNull Builder setPadding(@NonNull Double setterArg) { - this.padding = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateNewLatLngBounds build() { - PlatformCameraUpdateNewLatLngBounds pigeonReturn = - new PlatformCameraUpdateNewLatLngBounds(); - pigeonReturn.setBounds(bounds); - pigeonReturn.setPadding(padding); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(bounds); - toListResult.add(padding); - return toListResult; - } - - static @NonNull PlatformCameraUpdateNewLatLngBounds fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateNewLatLngBounds pigeonResult = new PlatformCameraUpdateNewLatLngBounds(); - Object bounds = pigeonVar_list.get(0); - pigeonResult.setBounds((PlatformLatLngBounds) bounds); - Object padding = pigeonVar_list.get(1); - pigeonResult.setPadding((Double) padding); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of NewLatLngZoom - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateNewLatLngZoom { - private @NonNull PlatformLatLng latLng; - - public @NonNull PlatformLatLng getLatLng() { - return latLng; - } - - public void setLatLng(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"latLng\" is null."); - } - this.latLng = setterArg; - } - - private @NonNull Double zoom; - - public @NonNull Double getZoom() { - return zoom; - } - - public void setZoom(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zoom\" is null."); - } - this.zoom = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateNewLatLngZoom() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateNewLatLngZoom that = (PlatformCameraUpdateNewLatLngZoom) o; - return latLng.equals(that.latLng) && zoom.equals(that.zoom); - } - - @Override - public int hashCode() { - return Objects.hash(latLng, zoom); - } - - public static final class Builder { - - private @Nullable PlatformLatLng latLng; - - @CanIgnoreReturnValue - public @NonNull Builder setLatLng(@NonNull PlatformLatLng setterArg) { - this.latLng = setterArg; - return this; - } - - private @Nullable Double zoom; - - @CanIgnoreReturnValue - public @NonNull Builder setZoom(@NonNull Double setterArg) { - this.zoom = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateNewLatLngZoom build() { - PlatformCameraUpdateNewLatLngZoom pigeonReturn = new PlatformCameraUpdateNewLatLngZoom(); - pigeonReturn.setLatLng(latLng); - pigeonReturn.setZoom(zoom); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(latLng); - toListResult.add(zoom); - return toListResult; - } - - static @NonNull PlatformCameraUpdateNewLatLngZoom fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateNewLatLngZoom pigeonResult = new PlatformCameraUpdateNewLatLngZoom(); - Object latLng = pigeonVar_list.get(0); - pigeonResult.setLatLng((PlatformLatLng) latLng); - Object zoom = pigeonVar_list.get(1); - pigeonResult.setZoom((Double) zoom); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of ScrollBy - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateScrollBy { - private @NonNull Double dx; - - public @NonNull Double getDx() { - return dx; - } - - public void setDx(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"dx\" is null."); - } - this.dx = setterArg; - } - - private @NonNull Double dy; - - public @NonNull Double getDy() { - return dy; - } - - public void setDy(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"dy\" is null."); - } - this.dy = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateScrollBy() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateScrollBy that = (PlatformCameraUpdateScrollBy) o; - return dx.equals(that.dx) && dy.equals(that.dy); - } - - @Override - public int hashCode() { - return Objects.hash(dx, dy); - } - - public static final class Builder { - - private @Nullable Double dx; - - @CanIgnoreReturnValue - public @NonNull Builder setDx(@NonNull Double setterArg) { - this.dx = setterArg; - return this; - } - - private @Nullable Double dy; - - @CanIgnoreReturnValue - public @NonNull Builder setDy(@NonNull Double setterArg) { - this.dy = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateScrollBy build() { - PlatformCameraUpdateScrollBy pigeonReturn = new PlatformCameraUpdateScrollBy(); - pigeonReturn.setDx(dx); - pigeonReturn.setDy(dy); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(dx); - toListResult.add(dy); - return toListResult; - } - - static @NonNull PlatformCameraUpdateScrollBy fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateScrollBy pigeonResult = new PlatformCameraUpdateScrollBy(); - Object dx = pigeonVar_list.get(0); - pigeonResult.setDx((Double) dx); - Object dy = pigeonVar_list.get(1); - pigeonResult.setDy((Double) dy); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of ZoomBy - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateZoomBy { - private @NonNull Double amount; - - public @NonNull Double getAmount() { - return amount; - } - - public void setAmount(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"amount\" is null."); - } - this.amount = setterArg; - } - - private @Nullable PlatformDoublePair focus; - - public @Nullable PlatformDoublePair getFocus() { - return focus; - } - - public void setFocus(@Nullable PlatformDoublePair setterArg) { - this.focus = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateZoomBy() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateZoomBy that = (PlatformCameraUpdateZoomBy) o; - return amount.equals(that.amount) && Objects.equals(focus, that.focus); - } - - @Override - public int hashCode() { - return Objects.hash(amount, focus); - } - - public static final class Builder { - - private @Nullable Double amount; - - @CanIgnoreReturnValue - public @NonNull Builder setAmount(@NonNull Double setterArg) { - this.amount = setterArg; - return this; - } - - private @Nullable PlatformDoublePair focus; - - @CanIgnoreReturnValue - public @NonNull Builder setFocus(@Nullable PlatformDoublePair setterArg) { - this.focus = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateZoomBy build() { - PlatformCameraUpdateZoomBy pigeonReturn = new PlatformCameraUpdateZoomBy(); - pigeonReturn.setAmount(amount); - pigeonReturn.setFocus(focus); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(amount); - toListResult.add(focus); - return toListResult; - } - - static @NonNull PlatformCameraUpdateZoomBy fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateZoomBy pigeonResult = new PlatformCameraUpdateZoomBy(); - Object amount = pigeonVar_list.get(0); - pigeonResult.setAmount((Double) amount); - Object focus = pigeonVar_list.get(1); - pigeonResult.setFocus((PlatformDoublePair) focus); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of ZoomIn/ZoomOut - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateZoom { - private @NonNull Boolean out; - - public @NonNull Boolean getOut() { - return out; - } - - public void setOut(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"out\" is null."); - } - this.out = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateZoom() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateZoom that = (PlatformCameraUpdateZoom) o; - return out.equals(that.out); - } - - @Override - public int hashCode() { - return Objects.hash(out); - } - - public static final class Builder { - - private @Nullable Boolean out; - - @CanIgnoreReturnValue - public @NonNull Builder setOut(@NonNull Boolean setterArg) { - this.out = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateZoom build() { - PlatformCameraUpdateZoom pigeonReturn = new PlatformCameraUpdateZoom(); - pigeonReturn.setOut(out); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(out); - return toListResult; - } - - static @NonNull PlatformCameraUpdateZoom fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateZoom pigeonResult = new PlatformCameraUpdateZoom(); - Object out = pigeonVar_list.get(0); - pigeonResult.setOut((Boolean) out); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of ZoomTo - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraUpdateZoomTo { - private @NonNull Double zoom; - - public @NonNull Double getZoom() { - return zoom; - } - - public void setZoom(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zoom\" is null."); - } - this.zoom = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCameraUpdateZoomTo() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraUpdateZoomTo that = (PlatformCameraUpdateZoomTo) o; - return zoom.equals(that.zoom); - } - - @Override - public int hashCode() { - return Objects.hash(zoom); - } - - public static final class Builder { - - private @Nullable Double zoom; - - @CanIgnoreReturnValue - public @NonNull Builder setZoom(@NonNull Double setterArg) { - this.zoom = setterArg; - return this; - } - - public @NonNull PlatformCameraUpdateZoomTo build() { - PlatformCameraUpdateZoomTo pigeonReturn = new PlatformCameraUpdateZoomTo(); - pigeonReturn.setZoom(zoom); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(zoom); - return toListResult; - } - - static @NonNull PlatformCameraUpdateZoomTo fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCameraUpdateZoomTo pigeonResult = new PlatformCameraUpdateZoomTo(); - Object zoom = pigeonVar_list.get(0); - pigeonResult.setZoom((Double) zoom); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the Circle class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCircle { - private @NonNull Boolean consumeTapEvents; - - public @NonNull Boolean getConsumeTapEvents() { - return consumeTapEvents; - } - - public void setConsumeTapEvents(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"consumeTapEvents\" is null."); - } - this.consumeTapEvents = setterArg; - } - - private @NonNull PlatformColor fillColor; - - public @NonNull PlatformColor getFillColor() { - return fillColor; - } - - public void setFillColor(@NonNull PlatformColor setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"fillColor\" is null."); - } - this.fillColor = setterArg; - } - - private @NonNull PlatformColor strokeColor; - - public @NonNull PlatformColor getStrokeColor() { - return strokeColor; - } - - public void setStrokeColor(@NonNull PlatformColor setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"strokeColor\" is null."); - } - this.strokeColor = setterArg; - } - - private @NonNull Boolean visible; - - public @NonNull Boolean getVisible() { - return visible; - } - - public void setVisible(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"visible\" is null."); - } - this.visible = setterArg; - } - - private @NonNull Long strokeWidth; - - public @NonNull Long getStrokeWidth() { - return strokeWidth; - } - - public void setStrokeWidth(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"strokeWidth\" is null."); - } - this.strokeWidth = setterArg; - } - - private @NonNull Double zIndex; - - public @NonNull Double getZIndex() { - return zIndex; - } - - public void setZIndex(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zIndex\" is null."); - } - this.zIndex = setterArg; - } - - private @NonNull PlatformLatLng center; - - public @NonNull PlatformLatLng getCenter() { - return center; - } - - public void setCenter(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"center\" is null."); - } - this.center = setterArg; - } - - private @NonNull Double radius; - - public @NonNull Double getRadius() { - return radius; - } - - public void setRadius(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"radius\" is null."); - } - this.radius = setterArg; - } - - private @NonNull String circleId; - - public @NonNull String getCircleId() { - return circleId; - } - - public void setCircleId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"circleId\" is null."); - } - this.circleId = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCircle() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCircle that = (PlatformCircle) o; - return consumeTapEvents.equals(that.consumeTapEvents) - && fillColor.equals(that.fillColor) - && strokeColor.equals(that.strokeColor) - && visible.equals(that.visible) - && strokeWidth.equals(that.strokeWidth) - && zIndex.equals(that.zIndex) - && center.equals(that.center) - && radius.equals(that.radius) - && circleId.equals(that.circleId); - } - - @Override - public int hashCode() { - return Objects.hash( - consumeTapEvents, - fillColor, - strokeColor, - visible, - strokeWidth, - zIndex, - center, - radius, - circleId); - } - - public static final class Builder { - - private @Nullable Boolean consumeTapEvents; - - @CanIgnoreReturnValue - public @NonNull Builder setConsumeTapEvents(@NonNull Boolean setterArg) { - this.consumeTapEvents = setterArg; - return this; - } - - private @Nullable PlatformColor fillColor; - - @CanIgnoreReturnValue - public @NonNull Builder setFillColor(@NonNull PlatformColor setterArg) { - this.fillColor = setterArg; - return this; - } - - private @Nullable PlatformColor strokeColor; - - @CanIgnoreReturnValue - public @NonNull Builder setStrokeColor(@NonNull PlatformColor setterArg) { - this.strokeColor = setterArg; - return this; - } - - private @Nullable Boolean visible; - - @CanIgnoreReturnValue - public @NonNull Builder setVisible(@NonNull Boolean setterArg) { - this.visible = setterArg; - return this; - } - - private @Nullable Long strokeWidth; - - @CanIgnoreReturnValue - public @NonNull Builder setStrokeWidth(@NonNull Long setterArg) { - this.strokeWidth = setterArg; - return this; - } - - private @Nullable Double zIndex; - - @CanIgnoreReturnValue - public @NonNull Builder setZIndex(@NonNull Double setterArg) { - this.zIndex = setterArg; - return this; - } - - private @Nullable PlatformLatLng center; - - @CanIgnoreReturnValue - public @NonNull Builder setCenter(@NonNull PlatformLatLng setterArg) { - this.center = setterArg; - return this; - } - - private @Nullable Double radius; - - @CanIgnoreReturnValue - public @NonNull Builder setRadius(@NonNull Double setterArg) { - this.radius = setterArg; - return this; - } - - private @Nullable String circleId; - - @CanIgnoreReturnValue - public @NonNull Builder setCircleId(@NonNull String setterArg) { - this.circleId = setterArg; - return this; - } - - public @NonNull PlatformCircle build() { - PlatformCircle pigeonReturn = new PlatformCircle(); - pigeonReturn.setConsumeTapEvents(consumeTapEvents); - pigeonReturn.setFillColor(fillColor); - pigeonReturn.setStrokeColor(strokeColor); - pigeonReturn.setVisible(visible); - pigeonReturn.setStrokeWidth(strokeWidth); - pigeonReturn.setZIndex(zIndex); - pigeonReturn.setCenter(center); - pigeonReturn.setRadius(radius); - pigeonReturn.setCircleId(circleId); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(9); - toListResult.add(consumeTapEvents); - toListResult.add(fillColor); - toListResult.add(strokeColor); - toListResult.add(visible); - toListResult.add(strokeWidth); - toListResult.add(zIndex); - toListResult.add(center); - toListResult.add(radius); - toListResult.add(circleId); - return toListResult; - } - - static @NonNull PlatformCircle fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCircle pigeonResult = new PlatformCircle(); - Object consumeTapEvents = pigeonVar_list.get(0); - pigeonResult.setConsumeTapEvents((Boolean) consumeTapEvents); - Object fillColor = pigeonVar_list.get(1); - pigeonResult.setFillColor((PlatformColor) fillColor); - Object strokeColor = pigeonVar_list.get(2); - pigeonResult.setStrokeColor((PlatformColor) strokeColor); - Object visible = pigeonVar_list.get(3); - pigeonResult.setVisible((Boolean) visible); - Object strokeWidth = pigeonVar_list.get(4); - pigeonResult.setStrokeWidth((Long) strokeWidth); - Object zIndex = pigeonVar_list.get(5); - pigeonResult.setZIndex((Double) zIndex); - Object center = pigeonVar_list.get(6); - pigeonResult.setCenter((PlatformLatLng) center); - Object radius = pigeonVar_list.get(7); - pigeonResult.setRadius((Double) radius); - Object circleId = pigeonVar_list.get(8); - pigeonResult.setCircleId((String) circleId); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the Heatmap class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformHeatmap { - private @NonNull String heatmapId; - - public @NonNull String getHeatmapId() { - return heatmapId; - } - - public void setHeatmapId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"heatmapId\" is null."); - } - this.heatmapId = setterArg; - } - - private @NonNull List data; - - public @NonNull List getData() { - return data; - } - - public void setData(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"data\" is null."); - } - this.data = setterArg; - } - - private @Nullable PlatformHeatmapGradient gradient; - - public @Nullable PlatformHeatmapGradient getGradient() { - return gradient; - } - - public void setGradient(@Nullable PlatformHeatmapGradient setterArg) { - this.gradient = setterArg; - } - - private @NonNull Double opacity; - - public @NonNull Double getOpacity() { - return opacity; - } - - public void setOpacity(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"opacity\" is null."); - } - this.opacity = setterArg; - } - - private @NonNull Long radius; - - public @NonNull Long getRadius() { - return radius; - } - - public void setRadius(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"radius\" is null."); - } - this.radius = setterArg; - } - - private @Nullable Double maxIntensity; - - public @Nullable Double getMaxIntensity() { - return maxIntensity; - } - - public void setMaxIntensity(@Nullable Double setterArg) { - this.maxIntensity = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformHeatmap() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformHeatmap that = (PlatformHeatmap) o; - return heatmapId.equals(that.heatmapId) - && data.equals(that.data) - && Objects.equals(gradient, that.gradient) - && opacity.equals(that.opacity) - && radius.equals(that.radius) - && Objects.equals(maxIntensity, that.maxIntensity); - } - - @Override - public int hashCode() { - return Objects.hash(heatmapId, data, gradient, opacity, radius, maxIntensity); - } - - public static final class Builder { - - private @Nullable String heatmapId; - - @CanIgnoreReturnValue - public @NonNull Builder setHeatmapId(@NonNull String setterArg) { - this.heatmapId = setterArg; - return this; - } - - private @Nullable List data; - - @CanIgnoreReturnValue - public @NonNull Builder setData(@NonNull List setterArg) { - this.data = setterArg; - return this; - } - - private @Nullable PlatformHeatmapGradient gradient; - - @CanIgnoreReturnValue - public @NonNull Builder setGradient(@Nullable PlatformHeatmapGradient setterArg) { - this.gradient = setterArg; - return this; - } - - private @Nullable Double opacity; - - @CanIgnoreReturnValue - public @NonNull Builder setOpacity(@NonNull Double setterArg) { - this.opacity = setterArg; - return this; - } - - private @Nullable Long radius; - - @CanIgnoreReturnValue - public @NonNull Builder setRadius(@NonNull Long setterArg) { - this.radius = setterArg; - return this; - } - - private @Nullable Double maxIntensity; - - @CanIgnoreReturnValue - public @NonNull Builder setMaxIntensity(@Nullable Double setterArg) { - this.maxIntensity = setterArg; - return this; - } - - public @NonNull PlatformHeatmap build() { - PlatformHeatmap pigeonReturn = new PlatformHeatmap(); - pigeonReturn.setHeatmapId(heatmapId); - pigeonReturn.setData(data); - pigeonReturn.setGradient(gradient); - pigeonReturn.setOpacity(opacity); - pigeonReturn.setRadius(radius); - pigeonReturn.setMaxIntensity(maxIntensity); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(6); - toListResult.add(heatmapId); - toListResult.add(data); - toListResult.add(gradient); - toListResult.add(opacity); - toListResult.add(radius); - toListResult.add(maxIntensity); - return toListResult; - } - - static @NonNull PlatformHeatmap fromList(@NonNull ArrayList pigeonVar_list) { - PlatformHeatmap pigeonResult = new PlatformHeatmap(); - Object heatmapId = pigeonVar_list.get(0); - pigeonResult.setHeatmapId((String) heatmapId); - Object data = pigeonVar_list.get(1); - pigeonResult.setData((List) data); - Object gradient = pigeonVar_list.get(2); - pigeonResult.setGradient((PlatformHeatmapGradient) gradient); - Object opacity = pigeonVar_list.get(3); - pigeonResult.setOpacity((Double) opacity); - Object radius = pigeonVar_list.get(4); - pigeonResult.setRadius((Long) radius); - Object maxIntensity = pigeonVar_list.get(5); - pigeonResult.setMaxIntensity((Double) maxIntensity); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the HeatmapGradient class. - * - *

The Java Gradient structure is slightly different from HeatmapGradient, so this matches the - * Android API so that conversion can be done on the Dart side where the structures are easier to - * work with. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformHeatmapGradient { - private @NonNull List colors; - - public @NonNull List getColors() { - return colors; - } - - public void setColors(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"colors\" is null."); - } - this.colors = setterArg; - } - - private @NonNull List startPoints; - - public @NonNull List getStartPoints() { - return startPoints; - } - - public void setStartPoints(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"startPoints\" is null."); - } - this.startPoints = setterArg; - } - - private @NonNull Long colorMapSize; - - public @NonNull Long getColorMapSize() { - return colorMapSize; - } - - public void setColorMapSize(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"colorMapSize\" is null."); - } - this.colorMapSize = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformHeatmapGradient() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformHeatmapGradient that = (PlatformHeatmapGradient) o; - return colors.equals(that.colors) - && startPoints.equals(that.startPoints) - && colorMapSize.equals(that.colorMapSize); - } - - @Override - public int hashCode() { - return Objects.hash(colors, startPoints, colorMapSize); - } - - public static final class Builder { - - private @Nullable List colors; - - @CanIgnoreReturnValue - public @NonNull Builder setColors(@NonNull List setterArg) { - this.colors = setterArg; - return this; - } - - private @Nullable List startPoints; - - @CanIgnoreReturnValue - public @NonNull Builder setStartPoints(@NonNull List setterArg) { - this.startPoints = setterArg; - return this; - } - - private @Nullable Long colorMapSize; - - @CanIgnoreReturnValue - public @NonNull Builder setColorMapSize(@NonNull Long setterArg) { - this.colorMapSize = setterArg; - return this; - } - - public @NonNull PlatformHeatmapGradient build() { - PlatformHeatmapGradient pigeonReturn = new PlatformHeatmapGradient(); - pigeonReturn.setColors(colors); - pigeonReturn.setStartPoints(startPoints); - pigeonReturn.setColorMapSize(colorMapSize); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(colors); - toListResult.add(startPoints); - toListResult.add(colorMapSize); - return toListResult; - } - - static @NonNull PlatformHeatmapGradient fromList(@NonNull ArrayList pigeonVar_list) { - PlatformHeatmapGradient pigeonResult = new PlatformHeatmapGradient(); - Object colors = pigeonVar_list.get(0); - pigeonResult.setColors((List) colors); - Object startPoints = pigeonVar_list.get(1); - pigeonResult.setStartPoints((List) startPoints); - Object colorMapSize = pigeonVar_list.get(2); - pigeonResult.setColorMapSize((Long) colorMapSize); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the WeightedLatLng class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformWeightedLatLng { - private @NonNull PlatformLatLng point; - - public @NonNull PlatformLatLng getPoint() { - return point; - } - - public void setPoint(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"point\" is null."); - } - this.point = setterArg; - } - - private @NonNull Double weight; - - public @NonNull Double getWeight() { - return weight; - } - - public void setWeight(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"weight\" is null."); - } - this.weight = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformWeightedLatLng() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformWeightedLatLng that = (PlatformWeightedLatLng) o; - return point.equals(that.point) && weight.equals(that.weight); - } - - @Override - public int hashCode() { - return Objects.hash(point, weight); - } - - public static final class Builder { - - private @Nullable PlatformLatLng point; - - @CanIgnoreReturnValue - public @NonNull Builder setPoint(@NonNull PlatformLatLng setterArg) { - this.point = setterArg; - return this; - } - - private @Nullable Double weight; - - @CanIgnoreReturnValue - public @NonNull Builder setWeight(@NonNull Double setterArg) { - this.weight = setterArg; - return this; - } - - public @NonNull PlatformWeightedLatLng build() { - PlatformWeightedLatLng pigeonReturn = new PlatformWeightedLatLng(); - pigeonReturn.setPoint(point); - pigeonReturn.setWeight(weight); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(point); - toListResult.add(weight); - return toListResult; - } - - static @NonNull PlatformWeightedLatLng fromList(@NonNull ArrayList pigeonVar_list) { - PlatformWeightedLatLng pigeonResult = new PlatformWeightedLatLng(); - Object point = pigeonVar_list.get(0); - pigeonResult.setPoint((PlatformLatLng) point); - Object weight = pigeonVar_list.get(1); - pigeonResult.setWeight((Double) weight); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the ClusterManager class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformClusterManager { - private @NonNull String identifier; - - public @NonNull String getIdentifier() { - return identifier; - } - - public void setIdentifier(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"identifier\" is null."); - } - this.identifier = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformClusterManager() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformClusterManager that = (PlatformClusterManager) o; - return identifier.equals(that.identifier); - } - - @Override - public int hashCode() { - return Objects.hash(identifier); - } - - public static final class Builder { - - private @Nullable String identifier; - - @CanIgnoreReturnValue - public @NonNull Builder setIdentifier(@NonNull String setterArg) { - this.identifier = setterArg; - return this; - } - - public @NonNull PlatformClusterManager build() { - PlatformClusterManager pigeonReturn = new PlatformClusterManager(); - pigeonReturn.setIdentifier(identifier); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(identifier); - return toListResult; - } - - static @NonNull PlatformClusterManager fromList(@NonNull ArrayList pigeonVar_list) { - PlatformClusterManager pigeonResult = new PlatformClusterManager(); - Object identifier = pigeonVar_list.get(0); - pigeonResult.setIdentifier((String) identifier); - return pigeonResult; - } - } - - /** - * Pair of double values, such as for an offset or size. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformDoublePair { - private @NonNull Double x; - - public @NonNull Double getX() { - return x; - } - - public void setX(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"x\" is null."); - } - this.x = setterArg; - } - - private @NonNull Double y; - - public @NonNull Double getY() { - return y; - } - - public void setY(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"y\" is null."); - } - this.y = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformDoublePair() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformDoublePair that = (PlatformDoublePair) o; - return x.equals(that.x) && y.equals(that.y); - } - - @Override - public int hashCode() { - return Objects.hash(x, y); - } - - public static final class Builder { - - private @Nullable Double x; - - @CanIgnoreReturnValue - public @NonNull Builder setX(@NonNull Double setterArg) { - this.x = setterArg; - return this; - } - - private @Nullable Double y; - - @CanIgnoreReturnValue - public @NonNull Builder setY(@NonNull Double setterArg) { - this.y = setterArg; - return this; - } - - public @NonNull PlatformDoublePair build() { - PlatformDoublePair pigeonReturn = new PlatformDoublePair(); - pigeonReturn.setX(x); - pigeonReturn.setY(y); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(x); - toListResult.add(y); - return toListResult; - } - - static @NonNull PlatformDoublePair fromList(@NonNull ArrayList pigeonVar_list) { - PlatformDoublePair pigeonResult = new PlatformDoublePair(); - Object x = pigeonVar_list.get(0); - pigeonResult.setX((Double) x); - Object y = pigeonVar_list.get(1); - pigeonResult.setY((Double) y); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the Color class. - * - *

See https://developer.android.com/reference/android/graphics/Color.html. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformColor { - private @NonNull Long argbValue; - - public @NonNull Long getArgbValue() { - return argbValue; - } - - public void setArgbValue(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"argbValue\" is null."); - } - this.argbValue = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformColor() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformColor that = (PlatformColor) o; - return argbValue.equals(that.argbValue); - } - - @Override - public int hashCode() { - return Objects.hash(argbValue); - } - - public static final class Builder { - - private @Nullable Long argbValue; - - @CanIgnoreReturnValue - public @NonNull Builder setArgbValue(@NonNull Long setterArg) { - this.argbValue = setterArg; - return this; - } - - public @NonNull PlatformColor build() { - PlatformColor pigeonReturn = new PlatformColor(); - pigeonReturn.setArgbValue(argbValue); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(argbValue); - return toListResult; - } - - static @NonNull PlatformColor fromList(@NonNull ArrayList pigeonVar_list) { - PlatformColor pigeonResult = new PlatformColor(); - Object argbValue = pigeonVar_list.get(0); - pigeonResult.setArgbValue((Long) argbValue); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the InfoWindow class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformInfoWindow { - private @Nullable String title; - - public @Nullable String getTitle() { - return title; - } - - public void setTitle(@Nullable String setterArg) { - this.title = setterArg; - } - - private @Nullable String snippet; - - public @Nullable String getSnippet() { - return snippet; - } - - public void setSnippet(@Nullable String setterArg) { - this.snippet = setterArg; - } - - private @NonNull PlatformDoublePair anchor; - - public @NonNull PlatformDoublePair getAnchor() { - return anchor; - } - - public void setAnchor(@NonNull PlatformDoublePair setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"anchor\" is null."); - } - this.anchor = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformInfoWindow() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformInfoWindow that = (PlatformInfoWindow) o; - return Objects.equals(title, that.title) - && Objects.equals(snippet, that.snippet) - && anchor.equals(that.anchor); - } - - @Override - public int hashCode() { - return Objects.hash(title, snippet, anchor); - } - - public static final class Builder { - - private @Nullable String title; - - @CanIgnoreReturnValue - public @NonNull Builder setTitle(@Nullable String setterArg) { - this.title = setterArg; - return this; - } - - private @Nullable String snippet; - - @CanIgnoreReturnValue - public @NonNull Builder setSnippet(@Nullable String setterArg) { - this.snippet = setterArg; - return this; - } - - private @Nullable PlatformDoublePair anchor; - - @CanIgnoreReturnValue - public @NonNull Builder setAnchor(@NonNull PlatformDoublePair setterArg) { - this.anchor = setterArg; - return this; - } - - public @NonNull PlatformInfoWindow build() { - PlatformInfoWindow pigeonReturn = new PlatformInfoWindow(); - pigeonReturn.setTitle(title); - pigeonReturn.setSnippet(snippet); - pigeonReturn.setAnchor(anchor); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(title); - toListResult.add(snippet); - toListResult.add(anchor); - return toListResult; - } - - static @NonNull PlatformInfoWindow fromList(@NonNull ArrayList pigeonVar_list) { - PlatformInfoWindow pigeonResult = new PlatformInfoWindow(); - Object title = pigeonVar_list.get(0); - pigeonResult.setTitle((String) title); - Object snippet = pigeonVar_list.get(1); - pigeonResult.setSnippet((String) snippet); - Object anchor = pigeonVar_list.get(2); - pigeonResult.setAnchor((PlatformDoublePair) anchor); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the Marker class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformMarker { - private @NonNull Double alpha; - - public @NonNull Double getAlpha() { - return alpha; - } - - public void setAlpha(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"alpha\" is null."); - } - this.alpha = setterArg; - } - - private @NonNull PlatformDoublePair anchor; - - public @NonNull PlatformDoublePair getAnchor() { - return anchor; - } - - public void setAnchor(@NonNull PlatformDoublePair setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"anchor\" is null."); - } - this.anchor = setterArg; - } - - private @NonNull Boolean consumeTapEvents; - - public @NonNull Boolean getConsumeTapEvents() { - return consumeTapEvents; - } - - public void setConsumeTapEvents(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"consumeTapEvents\" is null."); - } - this.consumeTapEvents = setterArg; - } - - private @NonNull Boolean draggable; - - public @NonNull Boolean getDraggable() { - return draggable; - } - - public void setDraggable(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"draggable\" is null."); - } - this.draggable = setterArg; - } - - private @NonNull Boolean flat; - - public @NonNull Boolean getFlat() { - return flat; - } - - public void setFlat(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"flat\" is null."); - } - this.flat = setterArg; - } - - private @NonNull PlatformBitmap icon; - - public @NonNull PlatformBitmap getIcon() { - return icon; - } - - public void setIcon(@NonNull PlatformBitmap setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"icon\" is null."); - } - this.icon = setterArg; - } - - private @NonNull PlatformInfoWindow infoWindow; - - public @NonNull PlatformInfoWindow getInfoWindow() { - return infoWindow; - } - - public void setInfoWindow(@NonNull PlatformInfoWindow setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"infoWindow\" is null."); - } - this.infoWindow = setterArg; - } - - private @NonNull PlatformLatLng position; - - public @NonNull PlatformLatLng getPosition() { - return position; - } - - public void setPosition(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"position\" is null."); - } - this.position = setterArg; - } - - private @NonNull Double rotation; - - public @NonNull Double getRotation() { - return rotation; - } - - public void setRotation(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"rotation\" is null."); - } - this.rotation = setterArg; - } - - private @NonNull Boolean visible; - - public @NonNull Boolean getVisible() { - return visible; - } - - public void setVisible(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"visible\" is null."); - } - this.visible = setterArg; - } - - private @NonNull Double zIndex; - - public @NonNull Double getZIndex() { - return zIndex; - } - - public void setZIndex(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zIndex\" is null."); - } - this.zIndex = setterArg; - } - - private @NonNull String markerId; - - public @NonNull String getMarkerId() { - return markerId; - } - - public void setMarkerId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"markerId\" is null."); - } - this.markerId = setterArg; - } - - private @Nullable String clusterManagerId; - - public @Nullable String getClusterManagerId() { - return clusterManagerId; - } - - public void setClusterManagerId(@Nullable String setterArg) { - this.clusterManagerId = setterArg; - } - - private @NonNull PlatformMarkerCollisionBehavior collisionBehavior; - - public @NonNull PlatformMarkerCollisionBehavior getCollisionBehavior() { - return collisionBehavior; - } - - public void setCollisionBehavior(@NonNull PlatformMarkerCollisionBehavior setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"collisionBehavior\" is null."); - } - this.collisionBehavior = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformMarker() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformMarker that = (PlatformMarker) o; - return alpha.equals(that.alpha) - && anchor.equals(that.anchor) - && consumeTapEvents.equals(that.consumeTapEvents) - && draggable.equals(that.draggable) - && flat.equals(that.flat) - && icon.equals(that.icon) - && infoWindow.equals(that.infoWindow) - && position.equals(that.position) - && rotation.equals(that.rotation) - && visible.equals(that.visible) - && zIndex.equals(that.zIndex) - && markerId.equals(that.markerId) - && Objects.equals(clusterManagerId, that.clusterManagerId) - && collisionBehavior.equals(that.collisionBehavior); - } - - @Override - public int hashCode() { - return Objects.hash( - alpha, - anchor, - consumeTapEvents, - draggable, - flat, - icon, - infoWindow, - position, - rotation, - visible, - zIndex, - markerId, - clusterManagerId, - collisionBehavior); - } - - public static final class Builder { - - private @Nullable Double alpha; - - @CanIgnoreReturnValue - public @NonNull Builder setAlpha(@NonNull Double setterArg) { - this.alpha = setterArg; - return this; - } - - private @Nullable PlatformDoublePair anchor; - - @CanIgnoreReturnValue - public @NonNull Builder setAnchor(@NonNull PlatformDoublePair setterArg) { - this.anchor = setterArg; - return this; - } - - private @Nullable Boolean consumeTapEvents; - - @CanIgnoreReturnValue - public @NonNull Builder setConsumeTapEvents(@NonNull Boolean setterArg) { - this.consumeTapEvents = setterArg; - return this; - } - - private @Nullable Boolean draggable; - - @CanIgnoreReturnValue - public @NonNull Builder setDraggable(@NonNull Boolean setterArg) { - this.draggable = setterArg; - return this; - } - - private @Nullable Boolean flat; - - @CanIgnoreReturnValue - public @NonNull Builder setFlat(@NonNull Boolean setterArg) { - this.flat = setterArg; - return this; - } - - private @Nullable PlatformBitmap icon; - - @CanIgnoreReturnValue - public @NonNull Builder setIcon(@NonNull PlatformBitmap setterArg) { - this.icon = setterArg; - return this; - } - - private @Nullable PlatformInfoWindow infoWindow; - - @CanIgnoreReturnValue - public @NonNull Builder setInfoWindow(@NonNull PlatformInfoWindow setterArg) { - this.infoWindow = setterArg; - return this; - } - - private @Nullable PlatformLatLng position; - - @CanIgnoreReturnValue - public @NonNull Builder setPosition(@NonNull PlatformLatLng setterArg) { - this.position = setterArg; - return this; - } - - private @Nullable Double rotation; - - @CanIgnoreReturnValue - public @NonNull Builder setRotation(@NonNull Double setterArg) { - this.rotation = setterArg; - return this; - } - - private @Nullable Boolean visible; - - @CanIgnoreReturnValue - public @NonNull Builder setVisible(@NonNull Boolean setterArg) { - this.visible = setterArg; - return this; - } - - private @Nullable Double zIndex; - - @CanIgnoreReturnValue - public @NonNull Builder setZIndex(@NonNull Double setterArg) { - this.zIndex = setterArg; - return this; - } - - private @Nullable String markerId; - - @CanIgnoreReturnValue - public @NonNull Builder setMarkerId(@NonNull String setterArg) { - this.markerId = setterArg; - return this; - } - - private @Nullable String clusterManagerId; - - @CanIgnoreReturnValue - public @NonNull Builder setClusterManagerId(@Nullable String setterArg) { - this.clusterManagerId = setterArg; - return this; - } - - private @Nullable PlatformMarkerCollisionBehavior collisionBehavior; - - @CanIgnoreReturnValue - public @NonNull Builder setCollisionBehavior( - @NonNull PlatformMarkerCollisionBehavior setterArg) { - this.collisionBehavior = setterArg; - return this; - } - - public @NonNull PlatformMarker build() { - PlatformMarker pigeonReturn = new PlatformMarker(); - pigeonReturn.setAlpha(alpha); - pigeonReturn.setAnchor(anchor); - pigeonReturn.setConsumeTapEvents(consumeTapEvents); - pigeonReturn.setDraggable(draggable); - pigeonReturn.setFlat(flat); - pigeonReturn.setIcon(icon); - pigeonReturn.setInfoWindow(infoWindow); - pigeonReturn.setPosition(position); - pigeonReturn.setRotation(rotation); - pigeonReturn.setVisible(visible); - pigeonReturn.setZIndex(zIndex); - pigeonReturn.setMarkerId(markerId); - pigeonReturn.setClusterManagerId(clusterManagerId); - pigeonReturn.setCollisionBehavior(collisionBehavior); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(14); - toListResult.add(alpha); - toListResult.add(anchor); - toListResult.add(consumeTapEvents); - toListResult.add(draggable); - toListResult.add(flat); - toListResult.add(icon); - toListResult.add(infoWindow); - toListResult.add(position); - toListResult.add(rotation); - toListResult.add(visible); - toListResult.add(zIndex); - toListResult.add(markerId); - toListResult.add(clusterManagerId); - toListResult.add(collisionBehavior); - return toListResult; - } - - static @NonNull PlatformMarker fromList(@NonNull ArrayList pigeonVar_list) { - PlatformMarker pigeonResult = new PlatformMarker(); - Object alpha = pigeonVar_list.get(0); - pigeonResult.setAlpha((Double) alpha); - Object anchor = pigeonVar_list.get(1); - pigeonResult.setAnchor((PlatformDoublePair) anchor); - Object consumeTapEvents = pigeonVar_list.get(2); - pigeonResult.setConsumeTapEvents((Boolean) consumeTapEvents); - Object draggable = pigeonVar_list.get(3); - pigeonResult.setDraggable((Boolean) draggable); - Object flat = pigeonVar_list.get(4); - pigeonResult.setFlat((Boolean) flat); - Object icon = pigeonVar_list.get(5); - pigeonResult.setIcon((PlatformBitmap) icon); - Object infoWindow = pigeonVar_list.get(6); - pigeonResult.setInfoWindow((PlatformInfoWindow) infoWindow); - Object position = pigeonVar_list.get(7); - pigeonResult.setPosition((PlatformLatLng) position); - Object rotation = pigeonVar_list.get(8); - pigeonResult.setRotation((Double) rotation); - Object visible = pigeonVar_list.get(9); - pigeonResult.setVisible((Boolean) visible); - Object zIndex = pigeonVar_list.get(10); - pigeonResult.setZIndex((Double) zIndex); - Object markerId = pigeonVar_list.get(11); - pigeonResult.setMarkerId((String) markerId); - Object clusterManagerId = pigeonVar_list.get(12); - pigeonResult.setClusterManagerId((String) clusterManagerId); - Object collisionBehavior = pigeonVar_list.get(13); - pigeonResult.setCollisionBehavior((PlatformMarkerCollisionBehavior) collisionBehavior); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the Polygon class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformPolygon { - private @NonNull String polygonId; - - public @NonNull String getPolygonId() { - return polygonId; - } - - public void setPolygonId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"polygonId\" is null."); - } - this.polygonId = setterArg; - } - - private @NonNull Boolean consumesTapEvents; - - public @NonNull Boolean getConsumesTapEvents() { - return consumesTapEvents; - } - - public void setConsumesTapEvents(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"consumesTapEvents\" is null."); - } - this.consumesTapEvents = setterArg; - } - - private @NonNull PlatformColor fillColor; - - public @NonNull PlatformColor getFillColor() { - return fillColor; - } - - public void setFillColor(@NonNull PlatformColor setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"fillColor\" is null."); - } - this.fillColor = setterArg; - } - - private @NonNull Boolean geodesic; - - public @NonNull Boolean getGeodesic() { - return geodesic; - } - - public void setGeodesic(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"geodesic\" is null."); - } - this.geodesic = setterArg; - } - - private @NonNull List points; - - public @NonNull List getPoints() { - return points; - } - - public void setPoints(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"points\" is null."); - } - this.points = setterArg; - } - - private @NonNull List> holes; - - public @NonNull List> getHoles() { - return holes; - } - - public void setHoles(@NonNull List> setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"holes\" is null."); - } - this.holes = setterArg; - } - - private @NonNull Boolean visible; - - public @NonNull Boolean getVisible() { - return visible; - } - - public void setVisible(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"visible\" is null."); - } - this.visible = setterArg; - } - - private @NonNull PlatformColor strokeColor; - - public @NonNull PlatformColor getStrokeColor() { - return strokeColor; - } - - public void setStrokeColor(@NonNull PlatformColor setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"strokeColor\" is null."); - } - this.strokeColor = setterArg; - } - - private @NonNull Long strokeWidth; - - public @NonNull Long getStrokeWidth() { - return strokeWidth; - } - - public void setStrokeWidth(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"strokeWidth\" is null."); - } - this.strokeWidth = setterArg; - } - - private @NonNull Long zIndex; - - public @NonNull Long getZIndex() { - return zIndex; - } - - public void setZIndex(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zIndex\" is null."); - } - this.zIndex = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformPolygon() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformPolygon that = (PlatformPolygon) o; - return polygonId.equals(that.polygonId) - && consumesTapEvents.equals(that.consumesTapEvents) - && fillColor.equals(that.fillColor) - && geodesic.equals(that.geodesic) - && points.equals(that.points) - && holes.equals(that.holes) - && visible.equals(that.visible) - && strokeColor.equals(that.strokeColor) - && strokeWidth.equals(that.strokeWidth) - && zIndex.equals(that.zIndex); - } - - @Override - public int hashCode() { - return Objects.hash( - polygonId, - consumesTapEvents, - fillColor, - geodesic, - points, - holes, - visible, - strokeColor, - strokeWidth, - zIndex); - } - - public static final class Builder { - - private @Nullable String polygonId; - - @CanIgnoreReturnValue - public @NonNull Builder setPolygonId(@NonNull String setterArg) { - this.polygonId = setterArg; - return this; - } - - private @Nullable Boolean consumesTapEvents; - - @CanIgnoreReturnValue - public @NonNull Builder setConsumesTapEvents(@NonNull Boolean setterArg) { - this.consumesTapEvents = setterArg; - return this; - } - - private @Nullable PlatformColor fillColor; - - @CanIgnoreReturnValue - public @NonNull Builder setFillColor(@NonNull PlatformColor setterArg) { - this.fillColor = setterArg; - return this; - } - - private @Nullable Boolean geodesic; - - @CanIgnoreReturnValue - public @NonNull Builder setGeodesic(@NonNull Boolean setterArg) { - this.geodesic = setterArg; - return this; - } - - private @Nullable List points; - - @CanIgnoreReturnValue - public @NonNull Builder setPoints(@NonNull List setterArg) { - this.points = setterArg; - return this; - } - - private @Nullable List> holes; - - @CanIgnoreReturnValue - public @NonNull Builder setHoles(@NonNull List> setterArg) { - this.holes = setterArg; - return this; - } - - private @Nullable Boolean visible; - - @CanIgnoreReturnValue - public @NonNull Builder setVisible(@NonNull Boolean setterArg) { - this.visible = setterArg; - return this; - } - - private @Nullable PlatformColor strokeColor; - - @CanIgnoreReturnValue - public @NonNull Builder setStrokeColor(@NonNull PlatformColor setterArg) { - this.strokeColor = setterArg; - return this; - } - - private @Nullable Long strokeWidth; - - @CanIgnoreReturnValue - public @NonNull Builder setStrokeWidth(@NonNull Long setterArg) { - this.strokeWidth = setterArg; - return this; - } - - private @Nullable Long zIndex; - - @CanIgnoreReturnValue - public @NonNull Builder setZIndex(@NonNull Long setterArg) { - this.zIndex = setterArg; - return this; - } - - public @NonNull PlatformPolygon build() { - PlatformPolygon pigeonReturn = new PlatformPolygon(); - pigeonReturn.setPolygonId(polygonId); - pigeonReturn.setConsumesTapEvents(consumesTapEvents); - pigeonReturn.setFillColor(fillColor); - pigeonReturn.setGeodesic(geodesic); - pigeonReturn.setPoints(points); - pigeonReturn.setHoles(holes); - pigeonReturn.setVisible(visible); - pigeonReturn.setStrokeColor(strokeColor); - pigeonReturn.setStrokeWidth(strokeWidth); - pigeonReturn.setZIndex(zIndex); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(10); - toListResult.add(polygonId); - toListResult.add(consumesTapEvents); - toListResult.add(fillColor); - toListResult.add(geodesic); - toListResult.add(points); - toListResult.add(holes); - toListResult.add(visible); - toListResult.add(strokeColor); - toListResult.add(strokeWidth); - toListResult.add(zIndex); - return toListResult; - } - - static @NonNull PlatformPolygon fromList(@NonNull ArrayList pigeonVar_list) { - PlatformPolygon pigeonResult = new PlatformPolygon(); - Object polygonId = pigeonVar_list.get(0); - pigeonResult.setPolygonId((String) polygonId); - Object consumesTapEvents = pigeonVar_list.get(1); - pigeonResult.setConsumesTapEvents((Boolean) consumesTapEvents); - Object fillColor = pigeonVar_list.get(2); - pigeonResult.setFillColor((PlatformColor) fillColor); - Object geodesic = pigeonVar_list.get(3); - pigeonResult.setGeodesic((Boolean) geodesic); - Object points = pigeonVar_list.get(4); - pigeonResult.setPoints((List) points); - Object holes = pigeonVar_list.get(5); - pigeonResult.setHoles((List>) holes); - Object visible = pigeonVar_list.get(6); - pigeonResult.setVisible((Boolean) visible); - Object strokeColor = pigeonVar_list.get(7); - pigeonResult.setStrokeColor((PlatformColor) strokeColor); - Object strokeWidth = pigeonVar_list.get(8); - pigeonResult.setStrokeWidth((Long) strokeWidth); - Object zIndex = pigeonVar_list.get(9); - pigeonResult.setZIndex((Long) zIndex); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the Polyline class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformPolyline { - private @NonNull String polylineId; - - public @NonNull String getPolylineId() { - return polylineId; - } - - public void setPolylineId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"polylineId\" is null."); - } - this.polylineId = setterArg; - } - - private @NonNull Boolean consumesTapEvents; - - public @NonNull Boolean getConsumesTapEvents() { - return consumesTapEvents; - } - - public void setConsumesTapEvents(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"consumesTapEvents\" is null."); - } - this.consumesTapEvents = setterArg; - } - - private @NonNull PlatformColor color; - - public @NonNull PlatformColor getColor() { - return color; - } - - public void setColor(@NonNull PlatformColor setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"color\" is null."); - } - this.color = setterArg; - } - - private @NonNull Boolean geodesic; - - public @NonNull Boolean getGeodesic() { - return geodesic; - } - - public void setGeodesic(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"geodesic\" is null."); - } - this.geodesic = setterArg; - } - - /** The joint type. */ - private @NonNull PlatformJointType jointType; - - public @NonNull PlatformJointType getJointType() { - return jointType; - } - - public void setJointType(@NonNull PlatformJointType setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"jointType\" is null."); - } - this.jointType = setterArg; - } - - /** The pattern data, as a list of pattern items. */ - private @NonNull List patterns; - - public @NonNull List getPatterns() { - return patterns; - } - - public void setPatterns(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"patterns\" is null."); - } - this.patterns = setterArg; - } - - private @NonNull List points; - - public @NonNull List getPoints() { - return points; - } - - public void setPoints(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"points\" is null."); - } - this.points = setterArg; - } - - /** - * The cap at the start and end vertex of a polyline. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/Cap. - */ - private @NonNull PlatformCap startCap; - - public @NonNull PlatformCap getStartCap() { - return startCap; - } - - public void setStartCap(@NonNull PlatformCap setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"startCap\" is null."); - } - this.startCap = setterArg; - } - - private @NonNull PlatformCap endCap; - - public @NonNull PlatformCap getEndCap() { - return endCap; - } - - public void setEndCap(@NonNull PlatformCap setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"endCap\" is null."); - } - this.endCap = setterArg; - } - - private @NonNull Boolean visible; - - public @NonNull Boolean getVisible() { - return visible; - } - - public void setVisible(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"visible\" is null."); - } - this.visible = setterArg; - } - - private @NonNull Long width; - - public @NonNull Long getWidth() { - return width; - } - - public void setWidth(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"width\" is null."); - } - this.width = setterArg; - } - - private @NonNull Long zIndex; - - public @NonNull Long getZIndex() { - return zIndex; - } - - public void setZIndex(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zIndex\" is null."); - } - this.zIndex = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformPolyline() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformPolyline that = (PlatformPolyline) o; - return polylineId.equals(that.polylineId) - && consumesTapEvents.equals(that.consumesTapEvents) - && color.equals(that.color) - && geodesic.equals(that.geodesic) - && jointType.equals(that.jointType) - && patterns.equals(that.patterns) - && points.equals(that.points) - && startCap.equals(that.startCap) - && endCap.equals(that.endCap) - && visible.equals(that.visible) - && width.equals(that.width) - && zIndex.equals(that.zIndex); - } - - @Override - public int hashCode() { - return Objects.hash( - polylineId, - consumesTapEvents, - color, - geodesic, - jointType, - patterns, - points, - startCap, - endCap, - visible, - width, - zIndex); - } - - public static final class Builder { - - private @Nullable String polylineId; - - @CanIgnoreReturnValue - public @NonNull Builder setPolylineId(@NonNull String setterArg) { - this.polylineId = setterArg; - return this; - } - - private @Nullable Boolean consumesTapEvents; - - @CanIgnoreReturnValue - public @NonNull Builder setConsumesTapEvents(@NonNull Boolean setterArg) { - this.consumesTapEvents = setterArg; - return this; - } - - private @Nullable PlatformColor color; - - @CanIgnoreReturnValue - public @NonNull Builder setColor(@NonNull PlatformColor setterArg) { - this.color = setterArg; - return this; - } - - private @Nullable Boolean geodesic; - - @CanIgnoreReturnValue - public @NonNull Builder setGeodesic(@NonNull Boolean setterArg) { - this.geodesic = setterArg; - return this; - } - - private @Nullable PlatformJointType jointType; - - @CanIgnoreReturnValue - public @NonNull Builder setJointType(@NonNull PlatformJointType setterArg) { - this.jointType = setterArg; - return this; - } - - private @Nullable List patterns; - - @CanIgnoreReturnValue - public @NonNull Builder setPatterns(@NonNull List setterArg) { - this.patterns = setterArg; - return this; - } - - private @Nullable List points; - - @CanIgnoreReturnValue - public @NonNull Builder setPoints(@NonNull List setterArg) { - this.points = setterArg; - return this; - } - - private @Nullable PlatformCap startCap; - - @CanIgnoreReturnValue - public @NonNull Builder setStartCap(@NonNull PlatformCap setterArg) { - this.startCap = setterArg; - return this; - } - - private @Nullable PlatformCap endCap; - - @CanIgnoreReturnValue - public @NonNull Builder setEndCap(@NonNull PlatformCap setterArg) { - this.endCap = setterArg; - return this; - } - - private @Nullable Boolean visible; - - @CanIgnoreReturnValue - public @NonNull Builder setVisible(@NonNull Boolean setterArg) { - this.visible = setterArg; - return this; - } - - private @Nullable Long width; - - @CanIgnoreReturnValue - public @NonNull Builder setWidth(@NonNull Long setterArg) { - this.width = setterArg; - return this; - } - - private @Nullable Long zIndex; - - @CanIgnoreReturnValue - public @NonNull Builder setZIndex(@NonNull Long setterArg) { - this.zIndex = setterArg; - return this; - } - - public @NonNull PlatformPolyline build() { - PlatformPolyline pigeonReturn = new PlatformPolyline(); - pigeonReturn.setPolylineId(polylineId); - pigeonReturn.setConsumesTapEvents(consumesTapEvents); - pigeonReturn.setColor(color); - pigeonReturn.setGeodesic(geodesic); - pigeonReturn.setJointType(jointType); - pigeonReturn.setPatterns(patterns); - pigeonReturn.setPoints(points); - pigeonReturn.setStartCap(startCap); - pigeonReturn.setEndCap(endCap); - pigeonReturn.setVisible(visible); - pigeonReturn.setWidth(width); - pigeonReturn.setZIndex(zIndex); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(12); - toListResult.add(polylineId); - toListResult.add(consumesTapEvents); - toListResult.add(color); - toListResult.add(geodesic); - toListResult.add(jointType); - toListResult.add(patterns); - toListResult.add(points); - toListResult.add(startCap); - toListResult.add(endCap); - toListResult.add(visible); - toListResult.add(width); - toListResult.add(zIndex); - return toListResult; - } - - static @NonNull PlatformPolyline fromList(@NonNull ArrayList pigeonVar_list) { - PlatformPolyline pigeonResult = new PlatformPolyline(); - Object polylineId = pigeonVar_list.get(0); - pigeonResult.setPolylineId((String) polylineId); - Object consumesTapEvents = pigeonVar_list.get(1); - pigeonResult.setConsumesTapEvents((Boolean) consumesTapEvents); - Object color = pigeonVar_list.get(2); - pigeonResult.setColor((PlatformColor) color); - Object geodesic = pigeonVar_list.get(3); - pigeonResult.setGeodesic((Boolean) geodesic); - Object jointType = pigeonVar_list.get(4); - pigeonResult.setJointType((PlatformJointType) jointType); - Object patterns = pigeonVar_list.get(5); - pigeonResult.setPatterns((List) patterns); - Object points = pigeonVar_list.get(6); - pigeonResult.setPoints((List) points); - Object startCap = pigeonVar_list.get(7); - pigeonResult.setStartCap((PlatformCap) startCap); - Object endCap = pigeonVar_list.get(8); - pigeonResult.setEndCap((PlatformCap) endCap); - Object visible = pigeonVar_list.get(9); - pigeonResult.setVisible((Boolean) visible); - Object width = pigeonVar_list.get(10); - pigeonResult.setWidth((Long) width); - Object zIndex = pigeonVar_list.get(11); - pigeonResult.setZIndex((Long) zIndex); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of Cap from the platform interface. - * https://github.com/flutter/packages/blob/main/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cap.dart - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCap { - private @NonNull PlatformCapType type; - - public @NonNull PlatformCapType getType() { - return type; - } - - public void setType(@NonNull PlatformCapType setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"type\" is null."); - } - this.type = setterArg; - } - - private @Nullable PlatformBitmap bitmapDescriptor; - - public @Nullable PlatformBitmap getBitmapDescriptor() { - return bitmapDescriptor; - } - - public void setBitmapDescriptor(@Nullable PlatformBitmap setterArg) { - this.bitmapDescriptor = setterArg; - } - - private @Nullable Double refWidth; - - public @Nullable Double getRefWidth() { - return refWidth; - } - - public void setRefWidth(@Nullable Double setterArg) { - this.refWidth = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCap() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCap that = (PlatformCap) o; - return type.equals(that.type) - && Objects.equals(bitmapDescriptor, that.bitmapDescriptor) - && Objects.equals(refWidth, that.refWidth); - } - - @Override - public int hashCode() { - return Objects.hash(type, bitmapDescriptor, refWidth); - } - - public static final class Builder { - - private @Nullable PlatformCapType type; - - @CanIgnoreReturnValue - public @NonNull Builder setType(@NonNull PlatformCapType setterArg) { - this.type = setterArg; - return this; - } - - private @Nullable PlatformBitmap bitmapDescriptor; - - @CanIgnoreReturnValue - public @NonNull Builder setBitmapDescriptor(@Nullable PlatformBitmap setterArg) { - this.bitmapDescriptor = setterArg; - return this; - } - - private @Nullable Double refWidth; - - @CanIgnoreReturnValue - public @NonNull Builder setRefWidth(@Nullable Double setterArg) { - this.refWidth = setterArg; - return this; - } - - public @NonNull PlatformCap build() { - PlatformCap pigeonReturn = new PlatformCap(); - pigeonReturn.setType(type); - pigeonReturn.setBitmapDescriptor(bitmapDescriptor); - pigeonReturn.setRefWidth(refWidth); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(type); - toListResult.add(bitmapDescriptor); - toListResult.add(refWidth); - return toListResult; - } - - static @NonNull PlatformCap fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCap pigeonResult = new PlatformCap(); - Object type = pigeonVar_list.get(0); - pigeonResult.setType((PlatformCapType) type); - Object bitmapDescriptor = pigeonVar_list.get(1); - pigeonResult.setBitmapDescriptor((PlatformBitmap) bitmapDescriptor); - Object refWidth = pigeonVar_list.get(2); - pigeonResult.setRefWidth((Double) refWidth); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the PatternItem class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformPatternItem { - private @NonNull PlatformPatternItemType type; - - public @NonNull PlatformPatternItemType getType() { - return type; - } - - public void setType(@NonNull PlatformPatternItemType setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"type\" is null."); - } - this.type = setterArg; - } - - private @Nullable Double length; - - public @Nullable Double getLength() { - return length; - } - - public void setLength(@Nullable Double setterArg) { - this.length = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformPatternItem() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformPatternItem that = (PlatformPatternItem) o; - return type.equals(that.type) && Objects.equals(length, that.length); - } - - @Override - public int hashCode() { - return Objects.hash(type, length); - } - - public static final class Builder { - - private @Nullable PlatformPatternItemType type; - - @CanIgnoreReturnValue - public @NonNull Builder setType(@NonNull PlatformPatternItemType setterArg) { - this.type = setterArg; - return this; - } - - private @Nullable Double length; - - @CanIgnoreReturnValue - public @NonNull Builder setLength(@Nullable Double setterArg) { - this.length = setterArg; - return this; - } - - public @NonNull PlatformPatternItem build() { - PlatformPatternItem pigeonReturn = new PlatformPatternItem(); - pigeonReturn.setType(type); - pigeonReturn.setLength(length); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(type); - toListResult.add(length); - return toListResult; - } - - static @NonNull PlatformPatternItem fromList(@NonNull ArrayList pigeonVar_list) { - PlatformPatternItem pigeonResult = new PlatformPatternItem(); - Object type = pigeonVar_list.get(0); - pigeonResult.setType((PlatformPatternItemType) type); - Object length = pigeonVar_list.get(1); - pigeonResult.setLength((Double) length); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the Tile class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformTile { - private @NonNull Long width; - - public @NonNull Long getWidth() { - return width; - } - - public void setWidth(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"width\" is null."); - } - this.width = setterArg; - } - - private @NonNull Long height; - - public @NonNull Long getHeight() { - return height; - } - - public void setHeight(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"height\" is null."); - } - this.height = setterArg; - } - - private @Nullable byte[] data; - - public @Nullable byte[] getData() { - return data; - } - - public void setData(@Nullable byte[] setterArg) { - this.data = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformTile() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformTile that = (PlatformTile) o; - return width.equals(that.width) - && height.equals(that.height) - && Arrays.equals(data, that.data); - } - - @Override - public int hashCode() { - int pigeonVar_result = Objects.hash(width, height); - pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(data); - return pigeonVar_result; - } - - public static final class Builder { - - private @Nullable Long width; - - @CanIgnoreReturnValue - public @NonNull Builder setWidth(@NonNull Long setterArg) { - this.width = setterArg; - return this; - } - - private @Nullable Long height; - - @CanIgnoreReturnValue - public @NonNull Builder setHeight(@NonNull Long setterArg) { - this.height = setterArg; - return this; - } - - private @Nullable byte[] data; - - @CanIgnoreReturnValue - public @NonNull Builder setData(@Nullable byte[] setterArg) { - this.data = setterArg; - return this; - } - - public @NonNull PlatformTile build() { - PlatformTile pigeonReturn = new PlatformTile(); - pigeonReturn.setWidth(width); - pigeonReturn.setHeight(height); - pigeonReturn.setData(data); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(width); - toListResult.add(height); - toListResult.add(data); - return toListResult; - } - - static @NonNull PlatformTile fromList(@NonNull ArrayList pigeonVar_list) { - PlatformTile pigeonResult = new PlatformTile(); - Object width = pigeonVar_list.get(0); - pigeonResult.setWidth((Long) width); - Object height = pigeonVar_list.get(1); - pigeonResult.setHeight((Long) height); - Object data = pigeonVar_list.get(2); - pigeonResult.setData((byte[]) data); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the TileOverlay class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformTileOverlay { - private @NonNull String tileOverlayId; - - public @NonNull String getTileOverlayId() { - return tileOverlayId; - } - - public void setTileOverlayId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"tileOverlayId\" is null."); - } - this.tileOverlayId = setterArg; - } - - private @NonNull Boolean fadeIn; - - public @NonNull Boolean getFadeIn() { - return fadeIn; - } - - public void setFadeIn(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"fadeIn\" is null."); - } - this.fadeIn = setterArg; - } - - private @NonNull Double transparency; - - public @NonNull Double getTransparency() { - return transparency; - } - - public void setTransparency(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"transparency\" is null."); - } - this.transparency = setterArg; - } - - private @NonNull Long zIndex; - - public @NonNull Long getZIndex() { - return zIndex; - } - - public void setZIndex(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zIndex\" is null."); - } - this.zIndex = setterArg; - } - - private @NonNull Boolean visible; - - public @NonNull Boolean getVisible() { - return visible; - } - - public void setVisible(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"visible\" is null."); - } - this.visible = setterArg; - } - - private @NonNull Long tileSize; - - public @NonNull Long getTileSize() { - return tileSize; - } - - public void setTileSize(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"tileSize\" is null."); - } - this.tileSize = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformTileOverlay() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformTileOverlay that = (PlatformTileOverlay) o; - return tileOverlayId.equals(that.tileOverlayId) - && fadeIn.equals(that.fadeIn) - && transparency.equals(that.transparency) - && zIndex.equals(that.zIndex) - && visible.equals(that.visible) - && tileSize.equals(that.tileSize); - } - - @Override - public int hashCode() { - return Objects.hash(tileOverlayId, fadeIn, transparency, zIndex, visible, tileSize); - } - - public static final class Builder { - - private @Nullable String tileOverlayId; - - @CanIgnoreReturnValue - public @NonNull Builder setTileOverlayId(@NonNull String setterArg) { - this.tileOverlayId = setterArg; - return this; - } - - private @Nullable Boolean fadeIn; - - @CanIgnoreReturnValue - public @NonNull Builder setFadeIn(@NonNull Boolean setterArg) { - this.fadeIn = setterArg; - return this; - } - - private @Nullable Double transparency; - - @CanIgnoreReturnValue - public @NonNull Builder setTransparency(@NonNull Double setterArg) { - this.transparency = setterArg; - return this; - } - - private @Nullable Long zIndex; - - @CanIgnoreReturnValue - public @NonNull Builder setZIndex(@NonNull Long setterArg) { - this.zIndex = setterArg; - return this; - } - - private @Nullable Boolean visible; - - @CanIgnoreReturnValue - public @NonNull Builder setVisible(@NonNull Boolean setterArg) { - this.visible = setterArg; - return this; - } - - private @Nullable Long tileSize; - - @CanIgnoreReturnValue - public @NonNull Builder setTileSize(@NonNull Long setterArg) { - this.tileSize = setterArg; - return this; - } - - public @NonNull PlatformTileOverlay build() { - PlatformTileOverlay pigeonReturn = new PlatformTileOverlay(); - pigeonReturn.setTileOverlayId(tileOverlayId); - pigeonReturn.setFadeIn(fadeIn); - pigeonReturn.setTransparency(transparency); - pigeonReturn.setZIndex(zIndex); - pigeonReturn.setVisible(visible); - pigeonReturn.setTileSize(tileSize); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(6); - toListResult.add(tileOverlayId); - toListResult.add(fadeIn); - toListResult.add(transparency); - toListResult.add(zIndex); - toListResult.add(visible); - toListResult.add(tileSize); - return toListResult; - } - - static @NonNull PlatformTileOverlay fromList(@NonNull ArrayList pigeonVar_list) { - PlatformTileOverlay pigeonResult = new PlatformTileOverlay(); - Object tileOverlayId = pigeonVar_list.get(0); - pigeonResult.setTileOverlayId((String) tileOverlayId); - Object fadeIn = pigeonVar_list.get(1); - pigeonResult.setFadeIn((Boolean) fadeIn); - Object transparency = pigeonVar_list.get(2); - pigeonResult.setTransparency((Double) transparency); - Object zIndex = pigeonVar_list.get(3); - pigeonResult.setZIndex((Long) zIndex); - Object visible = pigeonVar_list.get(4); - pigeonResult.setVisible((Boolean) visible); - Object tileSize = pigeonVar_list.get(5); - pigeonResult.setTileSize((Long) tileSize); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of Flutter's EdgeInsets. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformEdgeInsets { - private @NonNull Double top; - - public @NonNull Double getTop() { - return top; - } - - public void setTop(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"top\" is null."); - } - this.top = setterArg; - } - - private @NonNull Double bottom; - - public @NonNull Double getBottom() { - return bottom; - } - - public void setBottom(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bottom\" is null."); - } - this.bottom = setterArg; - } - - private @NonNull Double left; - - public @NonNull Double getLeft() { - return left; - } - - public void setLeft(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"left\" is null."); - } - this.left = setterArg; - } - - private @NonNull Double right; - - public @NonNull Double getRight() { - return right; - } - - public void setRight(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"right\" is null."); - } - this.right = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformEdgeInsets() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformEdgeInsets that = (PlatformEdgeInsets) o; - return top.equals(that.top) - && bottom.equals(that.bottom) - && left.equals(that.left) - && right.equals(that.right); - } - - @Override - public int hashCode() { - return Objects.hash(top, bottom, left, right); - } - - public static final class Builder { - - private @Nullable Double top; - - @CanIgnoreReturnValue - public @NonNull Builder setTop(@NonNull Double setterArg) { - this.top = setterArg; - return this; - } - - private @Nullable Double bottom; - - @CanIgnoreReturnValue - public @NonNull Builder setBottom(@NonNull Double setterArg) { - this.bottom = setterArg; - return this; - } - - private @Nullable Double left; - - @CanIgnoreReturnValue - public @NonNull Builder setLeft(@NonNull Double setterArg) { - this.left = setterArg; - return this; - } - - private @Nullable Double right; - - @CanIgnoreReturnValue - public @NonNull Builder setRight(@NonNull Double setterArg) { - this.right = setterArg; - return this; - } - - public @NonNull PlatformEdgeInsets build() { - PlatformEdgeInsets pigeonReturn = new PlatformEdgeInsets(); - pigeonReturn.setTop(top); - pigeonReturn.setBottom(bottom); - pigeonReturn.setLeft(left); - pigeonReturn.setRight(right); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(top); - toListResult.add(bottom); - toListResult.add(left); - toListResult.add(right); - return toListResult; - } - - static @NonNull PlatformEdgeInsets fromList(@NonNull ArrayList pigeonVar_list) { - PlatformEdgeInsets pigeonResult = new PlatformEdgeInsets(); - Object top = pigeonVar_list.get(0); - pigeonResult.setTop((Double) top); - Object bottom = pigeonVar_list.get(1); - pigeonResult.setBottom((Double) bottom); - Object left = pigeonVar_list.get(2); - pigeonResult.setLeft((Double) left); - Object right = pigeonVar_list.get(3); - pigeonResult.setRight((Double) right); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of LatLng. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformLatLng { - private @NonNull Double latitude; - - public @NonNull Double getLatitude() { - return latitude; - } - - public void setLatitude(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"latitude\" is null."); - } - this.latitude = setterArg; - } - - private @NonNull Double longitude; - - public @NonNull Double getLongitude() { - return longitude; - } - - public void setLongitude(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"longitude\" is null."); - } - this.longitude = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformLatLng() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformLatLng that = (PlatformLatLng) o; - return latitude.equals(that.latitude) && longitude.equals(that.longitude); - } - - @Override - public int hashCode() { - return Objects.hash(latitude, longitude); - } - - public static final class Builder { - - private @Nullable Double latitude; - - @CanIgnoreReturnValue - public @NonNull Builder setLatitude(@NonNull Double setterArg) { - this.latitude = setterArg; - return this; - } - - private @Nullable Double longitude; - - @CanIgnoreReturnValue - public @NonNull Builder setLongitude(@NonNull Double setterArg) { - this.longitude = setterArg; - return this; - } - - public @NonNull PlatformLatLng build() { - PlatformLatLng pigeonReturn = new PlatformLatLng(); - pigeonReturn.setLatitude(latitude); - pigeonReturn.setLongitude(longitude); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(latitude); - toListResult.add(longitude); - return toListResult; - } - - static @NonNull PlatformLatLng fromList(@NonNull ArrayList pigeonVar_list) { - PlatformLatLng pigeonResult = new PlatformLatLng(); - Object latitude = pigeonVar_list.get(0); - pigeonResult.setLatitude((Double) latitude); - Object longitude = pigeonVar_list.get(1); - pigeonResult.setLongitude((Double) longitude); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of LatLngBounds. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformLatLngBounds { - private @NonNull PlatformLatLng northeast; - - public @NonNull PlatformLatLng getNortheast() { - return northeast; - } - - public void setNortheast(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"northeast\" is null."); - } - this.northeast = setterArg; - } - - private @NonNull PlatformLatLng southwest; - - public @NonNull PlatformLatLng getSouthwest() { - return southwest; - } - - public void setSouthwest(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"southwest\" is null."); - } - this.southwest = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformLatLngBounds() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformLatLngBounds that = (PlatformLatLngBounds) o; - return northeast.equals(that.northeast) && southwest.equals(that.southwest); - } - - @Override - public int hashCode() { - return Objects.hash(northeast, southwest); - } - - public static final class Builder { - - private @Nullable PlatformLatLng northeast; - - @CanIgnoreReturnValue - public @NonNull Builder setNortheast(@NonNull PlatformLatLng setterArg) { - this.northeast = setterArg; - return this; - } - - private @Nullable PlatformLatLng southwest; - - @CanIgnoreReturnValue - public @NonNull Builder setSouthwest(@NonNull PlatformLatLng setterArg) { - this.southwest = setterArg; - return this; - } - - public @NonNull PlatformLatLngBounds build() { - PlatformLatLngBounds pigeonReturn = new PlatformLatLngBounds(); - pigeonReturn.setNortheast(northeast); - pigeonReturn.setSouthwest(southwest); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(northeast); - toListResult.add(southwest); - return toListResult; - } - - static @NonNull PlatformLatLngBounds fromList(@NonNull ArrayList pigeonVar_list) { - PlatformLatLngBounds pigeonResult = new PlatformLatLngBounds(); - Object northeast = pigeonVar_list.get(0); - pigeonResult.setNortheast((PlatformLatLng) northeast); - Object southwest = pigeonVar_list.get(1); - pigeonResult.setSouthwest((PlatformLatLng) southwest); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of Cluster. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCluster { - private @NonNull String clusterManagerId; - - public @NonNull String getClusterManagerId() { - return clusterManagerId; - } - - public void setClusterManagerId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"clusterManagerId\" is null."); - } - this.clusterManagerId = setterArg; - } - - private @NonNull PlatformLatLng position; - - public @NonNull PlatformLatLng getPosition() { - return position; - } - - public void setPosition(@NonNull PlatformLatLng setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"position\" is null."); - } - this.position = setterArg; - } - - private @NonNull PlatformLatLngBounds bounds; - - public @NonNull PlatformLatLngBounds getBounds() { - return bounds; - } - - public void setBounds(@NonNull PlatformLatLngBounds setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bounds\" is null."); - } - this.bounds = setterArg; - } - - private @NonNull List markerIds; - - public @NonNull List getMarkerIds() { - return markerIds; - } - - public void setMarkerIds(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"markerIds\" is null."); - } - this.markerIds = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformCluster() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCluster that = (PlatformCluster) o; - return clusterManagerId.equals(that.clusterManagerId) - && position.equals(that.position) - && bounds.equals(that.bounds) - && markerIds.equals(that.markerIds); - } - - @Override - public int hashCode() { - return Objects.hash(clusterManagerId, position, bounds, markerIds); - } - - public static final class Builder { - - private @Nullable String clusterManagerId; - - @CanIgnoreReturnValue - public @NonNull Builder setClusterManagerId(@NonNull String setterArg) { - this.clusterManagerId = setterArg; - return this; - } - - private @Nullable PlatformLatLng position; - - @CanIgnoreReturnValue - public @NonNull Builder setPosition(@NonNull PlatformLatLng setterArg) { - this.position = setterArg; - return this; - } - - private @Nullable PlatformLatLngBounds bounds; - - @CanIgnoreReturnValue - public @NonNull Builder setBounds(@NonNull PlatformLatLngBounds setterArg) { - this.bounds = setterArg; - return this; - } - - private @Nullable List markerIds; - - @CanIgnoreReturnValue - public @NonNull Builder setMarkerIds(@NonNull List setterArg) { - this.markerIds = setterArg; - return this; - } - - public @NonNull PlatformCluster build() { - PlatformCluster pigeonReturn = new PlatformCluster(); - pigeonReturn.setClusterManagerId(clusterManagerId); - pigeonReturn.setPosition(position); - pigeonReturn.setBounds(bounds); - pigeonReturn.setMarkerIds(markerIds); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(clusterManagerId); - toListResult.add(position); - toListResult.add(bounds); - toListResult.add(markerIds); - return toListResult; - } - - static @NonNull PlatformCluster fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCluster pigeonResult = new PlatformCluster(); - Object clusterManagerId = pigeonVar_list.get(0); - pigeonResult.setClusterManagerId((String) clusterManagerId); - Object position = pigeonVar_list.get(1); - pigeonResult.setPosition((PlatformLatLng) position); - Object bounds = pigeonVar_list.get(2); - pigeonResult.setBounds((PlatformLatLngBounds) bounds); - Object markerIds = pigeonVar_list.get(3); - pigeonResult.setMarkerIds((List) markerIds); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of the GroundOverlay class. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformGroundOverlay { - private @NonNull String groundOverlayId; - - public @NonNull String getGroundOverlayId() { - return groundOverlayId; - } - - public void setGroundOverlayId(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"groundOverlayId\" is null."); - } - this.groundOverlayId = setterArg; - } - - private @NonNull PlatformBitmap image; - - public @NonNull PlatformBitmap getImage() { - return image; - } - - public void setImage(@NonNull PlatformBitmap setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"image\" is null."); - } - this.image = setterArg; - } - - private @Nullable PlatformLatLng position; - - public @Nullable PlatformLatLng getPosition() { - return position; - } - - public void setPosition(@Nullable PlatformLatLng setterArg) { - this.position = setterArg; - } - - private @Nullable PlatformLatLngBounds bounds; - - public @Nullable PlatformLatLngBounds getBounds() { - return bounds; - } - - public void setBounds(@Nullable PlatformLatLngBounds setterArg) { - this.bounds = setterArg; - } - - private @Nullable Double width; - - public @Nullable Double getWidth() { - return width; - } - - public void setWidth(@Nullable Double setterArg) { - this.width = setterArg; - } - - private @Nullable Double height; - - public @Nullable Double getHeight() { - return height; - } - - public void setHeight(@Nullable Double setterArg) { - this.height = setterArg; - } - - private @Nullable PlatformDoublePair anchor; - - public @Nullable PlatformDoublePair getAnchor() { - return anchor; - } - - public void setAnchor(@Nullable PlatformDoublePair setterArg) { - this.anchor = setterArg; - } - - private @NonNull Double transparency; - - public @NonNull Double getTransparency() { - return transparency; - } - - public void setTransparency(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"transparency\" is null."); - } - this.transparency = setterArg; - } - - private @NonNull Double bearing; - - public @NonNull Double getBearing() { - return bearing; - } - - public void setBearing(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bearing\" is null."); - } - this.bearing = setterArg; - } - - private @NonNull Long zIndex; - - public @NonNull Long getZIndex() { - return zIndex; - } - - public void setZIndex(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zIndex\" is null."); - } - this.zIndex = setterArg; - } - - private @NonNull Boolean visible; - - public @NonNull Boolean getVisible() { - return visible; - } - - public void setVisible(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"visible\" is null."); - } - this.visible = setterArg; - } - - private @NonNull Boolean clickable; - - public @NonNull Boolean getClickable() { - return clickable; - } - - public void setClickable(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"clickable\" is null."); - } - this.clickable = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformGroundOverlay() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformGroundOverlay that = (PlatformGroundOverlay) o; - return groundOverlayId.equals(that.groundOverlayId) - && image.equals(that.image) - && Objects.equals(position, that.position) - && Objects.equals(bounds, that.bounds) - && Objects.equals(width, that.width) - && Objects.equals(height, that.height) - && Objects.equals(anchor, that.anchor) - && transparency.equals(that.transparency) - && bearing.equals(that.bearing) - && zIndex.equals(that.zIndex) - && visible.equals(that.visible) - && clickable.equals(that.clickable); - } - - @Override - public int hashCode() { - return Objects.hash( - groundOverlayId, - image, - position, - bounds, - width, - height, - anchor, - transparency, - bearing, - zIndex, - visible, - clickable); - } - - public static final class Builder { - - private @Nullable String groundOverlayId; - - @CanIgnoreReturnValue - public @NonNull Builder setGroundOverlayId(@NonNull String setterArg) { - this.groundOverlayId = setterArg; - return this; - } - - private @Nullable PlatformBitmap image; - - @CanIgnoreReturnValue - public @NonNull Builder setImage(@NonNull PlatformBitmap setterArg) { - this.image = setterArg; - return this; - } - - private @Nullable PlatformLatLng position; - - @CanIgnoreReturnValue - public @NonNull Builder setPosition(@Nullable PlatformLatLng setterArg) { - this.position = setterArg; - return this; - } - - private @Nullable PlatformLatLngBounds bounds; - - @CanIgnoreReturnValue - public @NonNull Builder setBounds(@Nullable PlatformLatLngBounds setterArg) { - this.bounds = setterArg; - return this; - } - - private @Nullable Double width; - - @CanIgnoreReturnValue - public @NonNull Builder setWidth(@Nullable Double setterArg) { - this.width = setterArg; - return this; - } - - private @Nullable Double height; - - @CanIgnoreReturnValue - public @NonNull Builder setHeight(@Nullable Double setterArg) { - this.height = setterArg; - return this; - } - - private @Nullable PlatformDoublePair anchor; - - @CanIgnoreReturnValue - public @NonNull Builder setAnchor(@Nullable PlatformDoublePair setterArg) { - this.anchor = setterArg; - return this; - } - - private @Nullable Double transparency; - - @CanIgnoreReturnValue - public @NonNull Builder setTransparency(@NonNull Double setterArg) { - this.transparency = setterArg; - return this; - } - - private @Nullable Double bearing; - - @CanIgnoreReturnValue - public @NonNull Builder setBearing(@NonNull Double setterArg) { - this.bearing = setterArg; - return this; - } - - private @Nullable Long zIndex; - - @CanIgnoreReturnValue - public @NonNull Builder setZIndex(@NonNull Long setterArg) { - this.zIndex = setterArg; - return this; - } - - private @Nullable Boolean visible; - - @CanIgnoreReturnValue - public @NonNull Builder setVisible(@NonNull Boolean setterArg) { - this.visible = setterArg; - return this; - } - - private @Nullable Boolean clickable; - - @CanIgnoreReturnValue - public @NonNull Builder setClickable(@NonNull Boolean setterArg) { - this.clickable = setterArg; - return this; - } - - public @NonNull PlatformGroundOverlay build() { - PlatformGroundOverlay pigeonReturn = new PlatformGroundOverlay(); - pigeonReturn.setGroundOverlayId(groundOverlayId); - pigeonReturn.setImage(image); - pigeonReturn.setPosition(position); - pigeonReturn.setBounds(bounds); - pigeonReturn.setWidth(width); - pigeonReturn.setHeight(height); - pigeonReturn.setAnchor(anchor); - pigeonReturn.setTransparency(transparency); - pigeonReturn.setBearing(bearing); - pigeonReturn.setZIndex(zIndex); - pigeonReturn.setVisible(visible); - pigeonReturn.setClickable(clickable); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(12); - toListResult.add(groundOverlayId); - toListResult.add(image); - toListResult.add(position); - toListResult.add(bounds); - toListResult.add(width); - toListResult.add(height); - toListResult.add(anchor); - toListResult.add(transparency); - toListResult.add(bearing); - toListResult.add(zIndex); - toListResult.add(visible); - toListResult.add(clickable); - return toListResult; - } - - static @NonNull PlatformGroundOverlay fromList(@NonNull ArrayList pigeonVar_list) { - PlatformGroundOverlay pigeonResult = new PlatformGroundOverlay(); - Object groundOverlayId = pigeonVar_list.get(0); - pigeonResult.setGroundOverlayId((String) groundOverlayId); - Object image = pigeonVar_list.get(1); - pigeonResult.setImage((PlatformBitmap) image); - Object position = pigeonVar_list.get(2); - pigeonResult.setPosition((PlatformLatLng) position); - Object bounds = pigeonVar_list.get(3); - pigeonResult.setBounds((PlatformLatLngBounds) bounds); - Object width = pigeonVar_list.get(4); - pigeonResult.setWidth((Double) width); - Object height = pigeonVar_list.get(5); - pigeonResult.setHeight((Double) height); - Object anchor = pigeonVar_list.get(6); - pigeonResult.setAnchor((PlatformDoublePair) anchor); - Object transparency = pigeonVar_list.get(7); - pigeonResult.setTransparency((Double) transparency); - Object bearing = pigeonVar_list.get(8); - pigeonResult.setBearing((Double) bearing); - Object zIndex = pigeonVar_list.get(9); - pigeonResult.setZIndex((Long) zIndex); - Object visible = pigeonVar_list.get(10); - pigeonResult.setVisible((Boolean) visible); - Object clickable = pigeonVar_list.get(11); - pigeonResult.setClickable((Boolean) clickable); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of CameraTargetBounds. - * - *

As with the Dart version, it exists to distinguish between not setting a a target, and - * having an explicitly unbounded target (null [bounds]). - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformCameraTargetBounds { - private @Nullable PlatformLatLngBounds bounds; - - public @Nullable PlatformLatLngBounds getBounds() { - return bounds; - } - - public void setBounds(@Nullable PlatformLatLngBounds setterArg) { - this.bounds = setterArg; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformCameraTargetBounds that = (PlatformCameraTargetBounds) o; - return Objects.equals(bounds, that.bounds); - } - - @Override - public int hashCode() { - return Objects.hash(bounds); - } - - public static final class Builder { - - private @Nullable PlatformLatLngBounds bounds; - - @CanIgnoreReturnValue - public @NonNull Builder setBounds(@Nullable PlatformLatLngBounds setterArg) { - this.bounds = setterArg; - return this; - } - - public @NonNull PlatformCameraTargetBounds build() { - PlatformCameraTargetBounds pigeonReturn = new PlatformCameraTargetBounds(); - pigeonReturn.setBounds(bounds); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(bounds); - return toListResult; - } - - static @NonNull PlatformCameraTargetBounds fromList(@NonNull ArrayList pigeonVar_list) { - PlatformCameraTargetBounds pigeonResult = new PlatformCameraTargetBounds(); - Object bounds = pigeonVar_list.get(0); - pigeonResult.setBounds((PlatformLatLngBounds) bounds); - return pigeonResult; - } - } - - /** - * Information passed to the platform view creation. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformMapViewCreationParams { - private @NonNull PlatformCameraPosition initialCameraPosition; - - public @NonNull PlatformCameraPosition getInitialCameraPosition() { - return initialCameraPosition; - } - - public void setInitialCameraPosition(@NonNull PlatformCameraPosition setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialCameraPosition\" is null."); - } - this.initialCameraPosition = setterArg; - } - - private @NonNull PlatformMapConfiguration mapConfiguration; - - public @NonNull PlatformMapConfiguration getMapConfiguration() { - return mapConfiguration; - } - - public void setMapConfiguration(@NonNull PlatformMapConfiguration setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"mapConfiguration\" is null."); - } - this.mapConfiguration = setterArg; - } - - private @NonNull List initialCircles; - - public @NonNull List getInitialCircles() { - return initialCircles; - } - - public void setInitialCircles(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialCircles\" is null."); - } - this.initialCircles = setterArg; - } - - private @NonNull List initialMarkers; - - public @NonNull List getInitialMarkers() { - return initialMarkers; - } - - public void setInitialMarkers(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialMarkers\" is null."); - } - this.initialMarkers = setterArg; - } - - private @NonNull List initialPolygons; - - public @NonNull List getInitialPolygons() { - return initialPolygons; - } - - public void setInitialPolygons(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialPolygons\" is null."); - } - this.initialPolygons = setterArg; - } - - private @NonNull List initialPolylines; - - public @NonNull List getInitialPolylines() { - return initialPolylines; - } - - public void setInitialPolylines(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialPolylines\" is null."); - } - this.initialPolylines = setterArg; - } - - private @NonNull List initialHeatmaps; - - public @NonNull List getInitialHeatmaps() { - return initialHeatmaps; - } - - public void setInitialHeatmaps(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialHeatmaps\" is null."); - } - this.initialHeatmaps = setterArg; - } - - private @NonNull List initialTileOverlays; - - public @NonNull List getInitialTileOverlays() { - return initialTileOverlays; - } - - public void setInitialTileOverlays(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialTileOverlays\" is null."); - } - this.initialTileOverlays = setterArg; - } - - private @NonNull List initialClusterManagers; - - public @NonNull List getInitialClusterManagers() { - return initialClusterManagers; - } - - public void setInitialClusterManagers(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialClusterManagers\" is null."); - } - this.initialClusterManagers = setterArg; - } - - private @NonNull List initialGroundOverlays; - - public @NonNull List getInitialGroundOverlays() { - return initialGroundOverlays; - } - - public void setInitialGroundOverlays(@NonNull List setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"initialGroundOverlays\" is null."); - } - this.initialGroundOverlays = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformMapViewCreationParams() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformMapViewCreationParams that = (PlatformMapViewCreationParams) o; - return initialCameraPosition.equals(that.initialCameraPosition) - && mapConfiguration.equals(that.mapConfiguration) - && initialCircles.equals(that.initialCircles) - && initialMarkers.equals(that.initialMarkers) - && initialPolygons.equals(that.initialPolygons) - && initialPolylines.equals(that.initialPolylines) - && initialHeatmaps.equals(that.initialHeatmaps) - && initialTileOverlays.equals(that.initialTileOverlays) - && initialClusterManagers.equals(that.initialClusterManagers) - && initialGroundOverlays.equals(that.initialGroundOverlays); - } - - @Override - public int hashCode() { - return Objects.hash( - initialCameraPosition, - mapConfiguration, - initialCircles, - initialMarkers, - initialPolygons, - initialPolylines, - initialHeatmaps, - initialTileOverlays, - initialClusterManagers, - initialGroundOverlays); - } - - public static final class Builder { - - private @Nullable PlatformCameraPosition initialCameraPosition; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialCameraPosition(@NonNull PlatformCameraPosition setterArg) { - this.initialCameraPosition = setterArg; - return this; - } - - private @Nullable PlatformMapConfiguration mapConfiguration; - - @CanIgnoreReturnValue - public @NonNull Builder setMapConfiguration(@NonNull PlatformMapConfiguration setterArg) { - this.mapConfiguration = setterArg; - return this; - } - - private @Nullable List initialCircles; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialCircles(@NonNull List setterArg) { - this.initialCircles = setterArg; - return this; - } - - private @Nullable List initialMarkers; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialMarkers(@NonNull List setterArg) { - this.initialMarkers = setterArg; - return this; - } - - private @Nullable List initialPolygons; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialPolygons(@NonNull List setterArg) { - this.initialPolygons = setterArg; - return this; - } - - private @Nullable List initialPolylines; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialPolylines(@NonNull List setterArg) { - this.initialPolylines = setterArg; - return this; - } - - private @Nullable List initialHeatmaps; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialHeatmaps(@NonNull List setterArg) { - this.initialHeatmaps = setterArg; - return this; - } - - private @Nullable List initialTileOverlays; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialTileOverlays(@NonNull List setterArg) { - this.initialTileOverlays = setterArg; - return this; - } - - private @Nullable List initialClusterManagers; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialClusterManagers( - @NonNull List setterArg) { - this.initialClusterManagers = setterArg; - return this; - } - - private @Nullable List initialGroundOverlays; - - @CanIgnoreReturnValue - public @NonNull Builder setInitialGroundOverlays( - @NonNull List setterArg) { - this.initialGroundOverlays = setterArg; - return this; - } - - public @NonNull PlatformMapViewCreationParams build() { - PlatformMapViewCreationParams pigeonReturn = new PlatformMapViewCreationParams(); - pigeonReturn.setInitialCameraPosition(initialCameraPosition); - pigeonReturn.setMapConfiguration(mapConfiguration); - pigeonReturn.setInitialCircles(initialCircles); - pigeonReturn.setInitialMarkers(initialMarkers); - pigeonReturn.setInitialPolygons(initialPolygons); - pigeonReturn.setInitialPolylines(initialPolylines); - pigeonReturn.setInitialHeatmaps(initialHeatmaps); - pigeonReturn.setInitialTileOverlays(initialTileOverlays); - pigeonReturn.setInitialClusterManagers(initialClusterManagers); - pigeonReturn.setInitialGroundOverlays(initialGroundOverlays); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(10); - toListResult.add(initialCameraPosition); - toListResult.add(mapConfiguration); - toListResult.add(initialCircles); - toListResult.add(initialMarkers); - toListResult.add(initialPolygons); - toListResult.add(initialPolylines); - toListResult.add(initialHeatmaps); - toListResult.add(initialTileOverlays); - toListResult.add(initialClusterManagers); - toListResult.add(initialGroundOverlays); - return toListResult; - } - - static @NonNull PlatformMapViewCreationParams fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformMapViewCreationParams pigeonResult = new PlatformMapViewCreationParams(); - Object initialCameraPosition = pigeonVar_list.get(0); - pigeonResult.setInitialCameraPosition((PlatformCameraPosition) initialCameraPosition); - Object mapConfiguration = pigeonVar_list.get(1); - pigeonResult.setMapConfiguration((PlatformMapConfiguration) mapConfiguration); - Object initialCircles = pigeonVar_list.get(2); - pigeonResult.setInitialCircles((List) initialCircles); - Object initialMarkers = pigeonVar_list.get(3); - pigeonResult.setInitialMarkers((List) initialMarkers); - Object initialPolygons = pigeonVar_list.get(4); - pigeonResult.setInitialPolygons((List) initialPolygons); - Object initialPolylines = pigeonVar_list.get(5); - pigeonResult.setInitialPolylines((List) initialPolylines); - Object initialHeatmaps = pigeonVar_list.get(6); - pigeonResult.setInitialHeatmaps((List) initialHeatmaps); - Object initialTileOverlays = pigeonVar_list.get(7); - pigeonResult.setInitialTileOverlays((List) initialTileOverlays); - Object initialClusterManagers = pigeonVar_list.get(8); - pigeonResult.setInitialClusterManagers((List) initialClusterManagers); - Object initialGroundOverlays = pigeonVar_list.get(9); - pigeonResult.setInitialGroundOverlays((List) initialGroundOverlays); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of MapConfiguration. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformMapConfiguration { - private @Nullable Boolean compassEnabled; - - public @Nullable Boolean getCompassEnabled() { - return compassEnabled; - } - - public void setCompassEnabled(@Nullable Boolean setterArg) { - this.compassEnabled = setterArg; - } - - private @Nullable PlatformCameraTargetBounds cameraTargetBounds; - - public @Nullable PlatformCameraTargetBounds getCameraTargetBounds() { - return cameraTargetBounds; - } - - public void setCameraTargetBounds(@Nullable PlatformCameraTargetBounds setterArg) { - this.cameraTargetBounds = setterArg; - } - - private @Nullable PlatformMapType mapType; - - public @Nullable PlatformMapType getMapType() { - return mapType; - } - - public void setMapType(@Nullable PlatformMapType setterArg) { - this.mapType = setterArg; - } - - private @Nullable PlatformZoomRange minMaxZoomPreference; - - public @Nullable PlatformZoomRange getMinMaxZoomPreference() { - return minMaxZoomPreference; - } - - public void setMinMaxZoomPreference(@Nullable PlatformZoomRange setterArg) { - this.minMaxZoomPreference = setterArg; - } - - private @Nullable Boolean mapToolbarEnabled; - - public @Nullable Boolean getMapToolbarEnabled() { - return mapToolbarEnabled; - } - - public void setMapToolbarEnabled(@Nullable Boolean setterArg) { - this.mapToolbarEnabled = setterArg; - } - - private @Nullable Boolean rotateGesturesEnabled; - - public @Nullable Boolean getRotateGesturesEnabled() { - return rotateGesturesEnabled; - } - - public void setRotateGesturesEnabled(@Nullable Boolean setterArg) { - this.rotateGesturesEnabled = setterArg; - } - - private @Nullable Boolean scrollGesturesEnabled; - - public @Nullable Boolean getScrollGesturesEnabled() { - return scrollGesturesEnabled; - } - - public void setScrollGesturesEnabled(@Nullable Boolean setterArg) { - this.scrollGesturesEnabled = setterArg; - } - - private @Nullable Boolean tiltGesturesEnabled; - - public @Nullable Boolean getTiltGesturesEnabled() { - return tiltGesturesEnabled; - } - - public void setTiltGesturesEnabled(@Nullable Boolean setterArg) { - this.tiltGesturesEnabled = setterArg; - } - - private @Nullable Boolean trackCameraPosition; - - public @Nullable Boolean getTrackCameraPosition() { - return trackCameraPosition; - } - - public void setTrackCameraPosition(@Nullable Boolean setterArg) { - this.trackCameraPosition = setterArg; - } - - private @Nullable Boolean zoomControlsEnabled; - - public @Nullable Boolean getZoomControlsEnabled() { - return zoomControlsEnabled; - } - - public void setZoomControlsEnabled(@Nullable Boolean setterArg) { - this.zoomControlsEnabled = setterArg; - } - - private @Nullable Boolean zoomGesturesEnabled; - - public @Nullable Boolean getZoomGesturesEnabled() { - return zoomGesturesEnabled; - } - - public void setZoomGesturesEnabled(@Nullable Boolean setterArg) { - this.zoomGesturesEnabled = setterArg; - } - - private @Nullable Boolean myLocationEnabled; - - public @Nullable Boolean getMyLocationEnabled() { - return myLocationEnabled; - } - - public void setMyLocationEnabled(@Nullable Boolean setterArg) { - this.myLocationEnabled = setterArg; - } - - private @Nullable Boolean myLocationButtonEnabled; - - public @Nullable Boolean getMyLocationButtonEnabled() { - return myLocationButtonEnabled; - } - - public void setMyLocationButtonEnabled(@Nullable Boolean setterArg) { - this.myLocationButtonEnabled = setterArg; - } - - private @Nullable PlatformEdgeInsets padding; - - public @Nullable PlatformEdgeInsets getPadding() { - return padding; - } - - public void setPadding(@Nullable PlatformEdgeInsets setterArg) { - this.padding = setterArg; - } - - private @Nullable Boolean indoorViewEnabled; - - public @Nullable Boolean getIndoorViewEnabled() { - return indoorViewEnabled; - } - - public void setIndoorViewEnabled(@Nullable Boolean setterArg) { - this.indoorViewEnabled = setterArg; - } - - private @Nullable Boolean trafficEnabled; - - public @Nullable Boolean getTrafficEnabled() { - return trafficEnabled; - } - - public void setTrafficEnabled(@Nullable Boolean setterArg) { - this.trafficEnabled = setterArg; - } - - private @Nullable Boolean buildingsEnabled; - - public @Nullable Boolean getBuildingsEnabled() { - return buildingsEnabled; - } - - public void setBuildingsEnabled(@Nullable Boolean setterArg) { - this.buildingsEnabled = setterArg; - } - - private @Nullable Boolean liteModeEnabled; - - public @Nullable Boolean getLiteModeEnabled() { - return liteModeEnabled; - } - - public void setLiteModeEnabled(@Nullable Boolean setterArg) { - this.liteModeEnabled = setterArg; - } - - private @NonNull PlatformMarkerType markerType; - - public @NonNull PlatformMarkerType getMarkerType() { - return markerType; - } - - public void setMarkerType(@NonNull PlatformMarkerType setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"markerType\" is null."); - } - this.markerType = setterArg; - } - - private @Nullable String mapId; - - public @Nullable String getMapId() { - return mapId; - } - - public void setMapId(@Nullable String setterArg) { - this.mapId = setterArg; - } - - private @Nullable String style; - - public @Nullable String getStyle() { - return style; - } - - public void setStyle(@Nullable String setterArg) { - this.style = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformMapConfiguration() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformMapConfiguration that = (PlatformMapConfiguration) o; - return Objects.equals(compassEnabled, that.compassEnabled) - && Objects.equals(cameraTargetBounds, that.cameraTargetBounds) - && Objects.equals(mapType, that.mapType) - && Objects.equals(minMaxZoomPreference, that.minMaxZoomPreference) - && Objects.equals(mapToolbarEnabled, that.mapToolbarEnabled) - && Objects.equals(rotateGesturesEnabled, that.rotateGesturesEnabled) - && Objects.equals(scrollGesturesEnabled, that.scrollGesturesEnabled) - && Objects.equals(tiltGesturesEnabled, that.tiltGesturesEnabled) - && Objects.equals(trackCameraPosition, that.trackCameraPosition) - && Objects.equals(zoomControlsEnabled, that.zoomControlsEnabled) - && Objects.equals(zoomGesturesEnabled, that.zoomGesturesEnabled) - && Objects.equals(myLocationEnabled, that.myLocationEnabled) - && Objects.equals(myLocationButtonEnabled, that.myLocationButtonEnabled) - && Objects.equals(padding, that.padding) - && Objects.equals(indoorViewEnabled, that.indoorViewEnabled) - && Objects.equals(trafficEnabled, that.trafficEnabled) - && Objects.equals(buildingsEnabled, that.buildingsEnabled) - && Objects.equals(liteModeEnabled, that.liteModeEnabled) - && markerType.equals(that.markerType) - && Objects.equals(mapId, that.mapId) - && Objects.equals(style, that.style); - } - - @Override - public int hashCode() { - return Objects.hash( - compassEnabled, - cameraTargetBounds, - mapType, - minMaxZoomPreference, - mapToolbarEnabled, - rotateGesturesEnabled, - scrollGesturesEnabled, - tiltGesturesEnabled, - trackCameraPosition, - zoomControlsEnabled, - zoomGesturesEnabled, - myLocationEnabled, - myLocationButtonEnabled, - padding, - indoorViewEnabled, - trafficEnabled, - buildingsEnabled, - liteModeEnabled, - markerType, - mapId, - style); - } - - public static final class Builder { - - private @Nullable Boolean compassEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setCompassEnabled(@Nullable Boolean setterArg) { - this.compassEnabled = setterArg; - return this; - } - - private @Nullable PlatformCameraTargetBounds cameraTargetBounds; - - @CanIgnoreReturnValue - public @NonNull Builder setCameraTargetBounds( - @Nullable PlatformCameraTargetBounds setterArg) { - this.cameraTargetBounds = setterArg; - return this; - } - - private @Nullable PlatformMapType mapType; - - @CanIgnoreReturnValue - public @NonNull Builder setMapType(@Nullable PlatformMapType setterArg) { - this.mapType = setterArg; - return this; - } - - private @Nullable PlatformZoomRange minMaxZoomPreference; - - @CanIgnoreReturnValue - public @NonNull Builder setMinMaxZoomPreference(@Nullable PlatformZoomRange setterArg) { - this.minMaxZoomPreference = setterArg; - return this; - } - - private @Nullable Boolean mapToolbarEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setMapToolbarEnabled(@Nullable Boolean setterArg) { - this.mapToolbarEnabled = setterArg; - return this; - } - - private @Nullable Boolean rotateGesturesEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setRotateGesturesEnabled(@Nullable Boolean setterArg) { - this.rotateGesturesEnabled = setterArg; - return this; - } - - private @Nullable Boolean scrollGesturesEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setScrollGesturesEnabled(@Nullable Boolean setterArg) { - this.scrollGesturesEnabled = setterArg; - return this; - } - - private @Nullable Boolean tiltGesturesEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setTiltGesturesEnabled(@Nullable Boolean setterArg) { - this.tiltGesturesEnabled = setterArg; - return this; - } - - private @Nullable Boolean trackCameraPosition; - - @CanIgnoreReturnValue - public @NonNull Builder setTrackCameraPosition(@Nullable Boolean setterArg) { - this.trackCameraPosition = setterArg; - return this; - } - - private @Nullable Boolean zoomControlsEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setZoomControlsEnabled(@Nullable Boolean setterArg) { - this.zoomControlsEnabled = setterArg; - return this; - } - - private @Nullable Boolean zoomGesturesEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setZoomGesturesEnabled(@Nullable Boolean setterArg) { - this.zoomGesturesEnabled = setterArg; - return this; - } - - private @Nullable Boolean myLocationEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setMyLocationEnabled(@Nullable Boolean setterArg) { - this.myLocationEnabled = setterArg; - return this; - } - - private @Nullable Boolean myLocationButtonEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setMyLocationButtonEnabled(@Nullable Boolean setterArg) { - this.myLocationButtonEnabled = setterArg; - return this; - } - - private @Nullable PlatformEdgeInsets padding; - - @CanIgnoreReturnValue - public @NonNull Builder setPadding(@Nullable PlatformEdgeInsets setterArg) { - this.padding = setterArg; - return this; - } - - private @Nullable Boolean indoorViewEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setIndoorViewEnabled(@Nullable Boolean setterArg) { - this.indoorViewEnabled = setterArg; - return this; - } - - private @Nullable Boolean trafficEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setTrafficEnabled(@Nullable Boolean setterArg) { - this.trafficEnabled = setterArg; - return this; - } - - private @Nullable Boolean buildingsEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setBuildingsEnabled(@Nullable Boolean setterArg) { - this.buildingsEnabled = setterArg; - return this; - } - - private @Nullable Boolean liteModeEnabled; - - @CanIgnoreReturnValue - public @NonNull Builder setLiteModeEnabled(@Nullable Boolean setterArg) { - this.liteModeEnabled = setterArg; - return this; - } - - private @Nullable PlatformMarkerType markerType; - - @CanIgnoreReturnValue - public @NonNull Builder setMarkerType(@NonNull PlatformMarkerType setterArg) { - this.markerType = setterArg; - return this; - } - - private @Nullable String mapId; - - @CanIgnoreReturnValue - public @NonNull Builder setMapId(@Nullable String setterArg) { - this.mapId = setterArg; - return this; - } - - private @Nullable String style; - - @CanIgnoreReturnValue - public @NonNull Builder setStyle(@Nullable String setterArg) { - this.style = setterArg; - return this; - } - - public @NonNull PlatformMapConfiguration build() { - PlatformMapConfiguration pigeonReturn = new PlatformMapConfiguration(); - pigeonReturn.setCompassEnabled(compassEnabled); - pigeonReturn.setCameraTargetBounds(cameraTargetBounds); - pigeonReturn.setMapType(mapType); - pigeonReturn.setMinMaxZoomPreference(minMaxZoomPreference); - pigeonReturn.setMapToolbarEnabled(mapToolbarEnabled); - pigeonReturn.setRotateGesturesEnabled(rotateGesturesEnabled); - pigeonReturn.setScrollGesturesEnabled(scrollGesturesEnabled); - pigeonReturn.setTiltGesturesEnabled(tiltGesturesEnabled); - pigeonReturn.setTrackCameraPosition(trackCameraPosition); - pigeonReturn.setZoomControlsEnabled(zoomControlsEnabled); - pigeonReturn.setZoomGesturesEnabled(zoomGesturesEnabled); - pigeonReturn.setMyLocationEnabled(myLocationEnabled); - pigeonReturn.setMyLocationButtonEnabled(myLocationButtonEnabled); - pigeonReturn.setPadding(padding); - pigeonReturn.setIndoorViewEnabled(indoorViewEnabled); - pigeonReturn.setTrafficEnabled(trafficEnabled); - pigeonReturn.setBuildingsEnabled(buildingsEnabled); - pigeonReturn.setLiteModeEnabled(liteModeEnabled); - pigeonReturn.setMarkerType(markerType); - pigeonReturn.setMapId(mapId); - pigeonReturn.setStyle(style); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(21); - toListResult.add(compassEnabled); - toListResult.add(cameraTargetBounds); - toListResult.add(mapType); - toListResult.add(minMaxZoomPreference); - toListResult.add(mapToolbarEnabled); - toListResult.add(rotateGesturesEnabled); - toListResult.add(scrollGesturesEnabled); - toListResult.add(tiltGesturesEnabled); - toListResult.add(trackCameraPosition); - toListResult.add(zoomControlsEnabled); - toListResult.add(zoomGesturesEnabled); - toListResult.add(myLocationEnabled); - toListResult.add(myLocationButtonEnabled); - toListResult.add(padding); - toListResult.add(indoorViewEnabled); - toListResult.add(trafficEnabled); - toListResult.add(buildingsEnabled); - toListResult.add(liteModeEnabled); - toListResult.add(markerType); - toListResult.add(mapId); - toListResult.add(style); - return toListResult; - } - - static @NonNull PlatformMapConfiguration fromList(@NonNull ArrayList pigeonVar_list) { - PlatformMapConfiguration pigeonResult = new PlatformMapConfiguration(); - Object compassEnabled = pigeonVar_list.get(0); - pigeonResult.setCompassEnabled((Boolean) compassEnabled); - Object cameraTargetBounds = pigeonVar_list.get(1); - pigeonResult.setCameraTargetBounds((PlatformCameraTargetBounds) cameraTargetBounds); - Object mapType = pigeonVar_list.get(2); - pigeonResult.setMapType((PlatformMapType) mapType); - Object minMaxZoomPreference = pigeonVar_list.get(3); - pigeonResult.setMinMaxZoomPreference((PlatformZoomRange) minMaxZoomPreference); - Object mapToolbarEnabled = pigeonVar_list.get(4); - pigeonResult.setMapToolbarEnabled((Boolean) mapToolbarEnabled); - Object rotateGesturesEnabled = pigeonVar_list.get(5); - pigeonResult.setRotateGesturesEnabled((Boolean) rotateGesturesEnabled); - Object scrollGesturesEnabled = pigeonVar_list.get(6); - pigeonResult.setScrollGesturesEnabled((Boolean) scrollGesturesEnabled); - Object tiltGesturesEnabled = pigeonVar_list.get(7); - pigeonResult.setTiltGesturesEnabled((Boolean) tiltGesturesEnabled); - Object trackCameraPosition = pigeonVar_list.get(8); - pigeonResult.setTrackCameraPosition((Boolean) trackCameraPosition); - Object zoomControlsEnabled = pigeonVar_list.get(9); - pigeonResult.setZoomControlsEnabled((Boolean) zoomControlsEnabled); - Object zoomGesturesEnabled = pigeonVar_list.get(10); - pigeonResult.setZoomGesturesEnabled((Boolean) zoomGesturesEnabled); - Object myLocationEnabled = pigeonVar_list.get(11); - pigeonResult.setMyLocationEnabled((Boolean) myLocationEnabled); - Object myLocationButtonEnabled = pigeonVar_list.get(12); - pigeonResult.setMyLocationButtonEnabled((Boolean) myLocationButtonEnabled); - Object padding = pigeonVar_list.get(13); - pigeonResult.setPadding((PlatformEdgeInsets) padding); - Object indoorViewEnabled = pigeonVar_list.get(14); - pigeonResult.setIndoorViewEnabled((Boolean) indoorViewEnabled); - Object trafficEnabled = pigeonVar_list.get(15); - pigeonResult.setTrafficEnabled((Boolean) trafficEnabled); - Object buildingsEnabled = pigeonVar_list.get(16); - pigeonResult.setBuildingsEnabled((Boolean) buildingsEnabled); - Object liteModeEnabled = pigeonVar_list.get(17); - pigeonResult.setLiteModeEnabled((Boolean) liteModeEnabled); - Object markerType = pigeonVar_list.get(18); - pigeonResult.setMarkerType((PlatformMarkerType) markerType); - Object mapId = pigeonVar_list.get(19); - pigeonResult.setMapId((String) mapId); - Object style = pigeonVar_list.get(20); - pigeonResult.setStyle((String) style); - return pigeonResult; - } - } - - /** - * Pigeon representation of an x,y coordinate. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformPoint { - private @NonNull Long x; - - public @NonNull Long getX() { - return x; - } - - public void setX(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"x\" is null."); - } - this.x = setterArg; - } - - private @NonNull Long y; - - public @NonNull Long getY() { - return y; - } - - public void setY(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"y\" is null."); - } - this.y = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformPoint() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformPoint that = (PlatformPoint) o; - return x.equals(that.x) && y.equals(that.y); - } - - @Override - public int hashCode() { - return Objects.hash(x, y); - } - - public static final class Builder { - - private @Nullable Long x; - - @CanIgnoreReturnValue - public @NonNull Builder setX(@NonNull Long setterArg) { - this.x = setterArg; - return this; - } - - private @Nullable Long y; - - @CanIgnoreReturnValue - public @NonNull Builder setY(@NonNull Long setterArg) { - this.y = setterArg; - return this; - } - - public @NonNull PlatformPoint build() { - PlatformPoint pigeonReturn = new PlatformPoint(); - pigeonReturn.setX(x); - pigeonReturn.setY(y); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(x); - toListResult.add(y); - return toListResult; - } - - static @NonNull PlatformPoint fromList(@NonNull ArrayList pigeonVar_list) { - PlatformPoint pigeonResult = new PlatformPoint(); - Object x = pigeonVar_list.get(0); - pigeonResult.setX((Long) x); - Object y = pigeonVar_list.get(1); - pigeonResult.setY((Long) y); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of native TileOverlay properties. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformTileLayer { - private @NonNull Boolean visible; - - public @NonNull Boolean getVisible() { - return visible; - } - - public void setVisible(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"visible\" is null."); - } - this.visible = setterArg; - } - - private @NonNull Boolean fadeIn; - - public @NonNull Boolean getFadeIn() { - return fadeIn; - } - - public void setFadeIn(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"fadeIn\" is null."); - } - this.fadeIn = setterArg; - } - - private @NonNull Double transparency; - - public @NonNull Double getTransparency() { - return transparency; - } - - public void setTransparency(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"transparency\" is null."); - } - this.transparency = setterArg; - } - - private @NonNull Double zIndex; - - public @NonNull Double getZIndex() { - return zIndex; - } - - public void setZIndex(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"zIndex\" is null."); - } - this.zIndex = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformTileLayer() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformTileLayer that = (PlatformTileLayer) o; - return visible.equals(that.visible) - && fadeIn.equals(that.fadeIn) - && transparency.equals(that.transparency) - && zIndex.equals(that.zIndex); - } - - @Override - public int hashCode() { - return Objects.hash(visible, fadeIn, transparency, zIndex); - } - - public static final class Builder { - - private @Nullable Boolean visible; - - @CanIgnoreReturnValue - public @NonNull Builder setVisible(@NonNull Boolean setterArg) { - this.visible = setterArg; - return this; - } - - private @Nullable Boolean fadeIn; - - @CanIgnoreReturnValue - public @NonNull Builder setFadeIn(@NonNull Boolean setterArg) { - this.fadeIn = setterArg; - return this; - } - - private @Nullable Double transparency; - - @CanIgnoreReturnValue - public @NonNull Builder setTransparency(@NonNull Double setterArg) { - this.transparency = setterArg; - return this; - } - - private @Nullable Double zIndex; - - @CanIgnoreReturnValue - public @NonNull Builder setZIndex(@NonNull Double setterArg) { - this.zIndex = setterArg; - return this; - } - - public @NonNull PlatformTileLayer build() { - PlatformTileLayer pigeonReturn = new PlatformTileLayer(); - pigeonReturn.setVisible(visible); - pigeonReturn.setFadeIn(fadeIn); - pigeonReturn.setTransparency(transparency); - pigeonReturn.setZIndex(zIndex); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(visible); - toListResult.add(fadeIn); - toListResult.add(transparency); - toListResult.add(zIndex); - return toListResult; - } - - static @NonNull PlatformTileLayer fromList(@NonNull ArrayList pigeonVar_list) { - PlatformTileLayer pigeonResult = new PlatformTileLayer(); - Object visible = pigeonVar_list.get(0); - pigeonResult.setVisible((Boolean) visible); - Object fadeIn = pigeonVar_list.get(1); - pigeonResult.setFadeIn((Boolean) fadeIn); - Object transparency = pigeonVar_list.get(2); - pigeonResult.setTransparency((Double) transparency); - Object zIndex = pigeonVar_list.get(3); - pigeonResult.setZIndex((Double) zIndex); - return pigeonResult; - } - } - - /** - * Possible outcomes of launching a URL. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformZoomRange { - private @Nullable Double min; - - public @Nullable Double getMin() { - return min; - } - - public void setMin(@Nullable Double setterArg) { - this.min = setterArg; - } - - private @Nullable Double max; - - public @Nullable Double getMax() { - return max; - } - - public void setMax(@Nullable Double setterArg) { - this.max = setterArg; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformZoomRange that = (PlatformZoomRange) o; - return Objects.equals(min, that.min) && Objects.equals(max, that.max); - } - - @Override - public int hashCode() { - return Objects.hash(min, max); - } - - public static final class Builder { - - private @Nullable Double min; - - @CanIgnoreReturnValue - public @NonNull Builder setMin(@Nullable Double setterArg) { - this.min = setterArg; - return this; - } - - private @Nullable Double max; - - @CanIgnoreReturnValue - public @NonNull Builder setMax(@Nullable Double setterArg) { - this.max = setterArg; - return this; - } - - public @NonNull PlatformZoomRange build() { - PlatformZoomRange pigeonReturn = new PlatformZoomRange(); - pigeonReturn.setMin(min); - pigeonReturn.setMax(max); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(min); - toListResult.add(max); - return toListResult; - } - - static @NonNull PlatformZoomRange fromList(@NonNull ArrayList pigeonVar_list) { - PlatformZoomRange pigeonResult = new PlatformZoomRange(); - Object min = pigeonVar_list.get(0); - pigeonResult.setMin((Double) min); - Object max = pigeonVar_list.get(1); - pigeonResult.setMax((Double) max); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [BitmapDescriptor]. As there are multiple disjoint types of - * [BitmapDescriptor], [PlatformBitmap] contains a single field which may hold the pigeon - * equivalent type of any of them. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmap { - /** - * One of [PlatformBitmapAssetMap], [PlatformBitmapAsset], [PlatformBitmapAssetImage], - * [PlatformBitmapBytesMap], [PlatformBitmapBytes], or [PlatformBitmapDefaultMarker]. As Pigeon - * does not currently support data class inheritance, this approach allows for the different - * bitmap implementations to be valid argument and return types of the API methods. See - * https://github.com/flutter/flutter/issues/117819. - */ - private @NonNull Object bitmap; - - public @NonNull Object getBitmap() { - return bitmap; - } - - public void setBitmap(@NonNull Object setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bitmap\" is null."); - } - this.bitmap = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformBitmap() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmap that = (PlatformBitmap) o; - return bitmap.equals(that.bitmap); - } - - @Override - public int hashCode() { - return Objects.hash(bitmap); - } - - public static final class Builder { - - private @Nullable Object bitmap; - - @CanIgnoreReturnValue - public @NonNull Builder setBitmap(@NonNull Object setterArg) { - this.bitmap = setterArg; - return this; - } - - public @NonNull PlatformBitmap build() { - PlatformBitmap pigeonReturn = new PlatformBitmap(); - pigeonReturn.setBitmap(bitmap); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(bitmap); - return toListResult; - } - - static @NonNull PlatformBitmap fromList(@NonNull ArrayList pigeonVar_list) { - PlatformBitmap pigeonResult = new PlatformBitmap(); - Object bitmap = pigeonVar_list.get(0); - pigeonResult.setBitmap(bitmap); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [DefaultMarker]. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#defaultMarker(float) - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmapDefaultMarker { - private @Nullable Double hue; - - public @Nullable Double getHue() { - return hue; - } - - public void setHue(@Nullable Double setterArg) { - this.hue = setterArg; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmapDefaultMarker that = (PlatformBitmapDefaultMarker) o; - return Objects.equals(hue, that.hue); - } - - @Override - public int hashCode() { - return Objects.hash(hue); - } - - public static final class Builder { - - private @Nullable Double hue; - - @CanIgnoreReturnValue - public @NonNull Builder setHue(@Nullable Double setterArg) { - this.hue = setterArg; - return this; - } - - public @NonNull PlatformBitmapDefaultMarker build() { - PlatformBitmapDefaultMarker pigeonReturn = new PlatformBitmapDefaultMarker(); - pigeonReturn.setHue(hue); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(hue); - return toListResult; - } - - static @NonNull PlatformBitmapDefaultMarker fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformBitmapDefaultMarker pigeonResult = new PlatformBitmapDefaultMarker(); - Object hue = pigeonVar_list.get(0); - pigeonResult.setHue((Double) hue); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [BytesBitmap]. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#fromBitmap(android.graphics.Bitmap) - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmapBytes { - private @NonNull byte[] byteData; - - public @NonNull byte[] getByteData() { - return byteData; - } - - public void setByteData(@NonNull byte[] setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"byteData\" is null."); - } - this.byteData = setterArg; - } - - private @Nullable PlatformDoublePair size; - - public @Nullable PlatformDoublePair getSize() { - return size; - } - - public void setSize(@Nullable PlatformDoublePair setterArg) { - this.size = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformBitmapBytes() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmapBytes that = (PlatformBitmapBytes) o; - return Arrays.equals(byteData, that.byteData) && Objects.equals(size, that.size); - } - - @Override - public int hashCode() { - int pigeonVar_result = Objects.hash(size); - pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(byteData); - return pigeonVar_result; - } - - public static final class Builder { - - private @Nullable byte[] byteData; - - @CanIgnoreReturnValue - public @NonNull Builder setByteData(@NonNull byte[] setterArg) { - this.byteData = setterArg; - return this; - } - - private @Nullable PlatformDoublePair size; - - @CanIgnoreReturnValue - public @NonNull Builder setSize(@Nullable PlatformDoublePair setterArg) { - this.size = setterArg; - return this; - } - - public @NonNull PlatformBitmapBytes build() { - PlatformBitmapBytes pigeonReturn = new PlatformBitmapBytes(); - pigeonReturn.setByteData(byteData); - pigeonReturn.setSize(size); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(byteData); - toListResult.add(size); - return toListResult; - } - - static @NonNull PlatformBitmapBytes fromList(@NonNull ArrayList pigeonVar_list) { - PlatformBitmapBytes pigeonResult = new PlatformBitmapBytes(); - Object byteData = pigeonVar_list.get(0); - pigeonResult.setByteData((byte[]) byteData); - Object size = pigeonVar_list.get(1); - pigeonResult.setSize((PlatformDoublePair) size); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [AssetBitmap]. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-fromasset-string-assetname - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmapAsset { - private @NonNull String name; - - public @NonNull String getName() { - return name; - } - - public void setName(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"name\" is null."); - } - this.name = setterArg; - } - - private @Nullable String pkg; - - public @Nullable String getPkg() { - return pkg; - } - - public void setPkg(@Nullable String setterArg) { - this.pkg = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformBitmapAsset() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmapAsset that = (PlatformBitmapAsset) o; - return name.equals(that.name) && Objects.equals(pkg, that.pkg); - } - - @Override - public int hashCode() { - return Objects.hash(name, pkg); - } - - public static final class Builder { - - private @Nullable String name; - - @CanIgnoreReturnValue - public @NonNull Builder setName(@NonNull String setterArg) { - this.name = setterArg; - return this; - } - - private @Nullable String pkg; - - @CanIgnoreReturnValue - public @NonNull Builder setPkg(@Nullable String setterArg) { - this.pkg = setterArg; - return this; - } - - public @NonNull PlatformBitmapAsset build() { - PlatformBitmapAsset pigeonReturn = new PlatformBitmapAsset(); - pigeonReturn.setName(name); - pigeonReturn.setPkg(pkg); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(name); - toListResult.add(pkg); - return toListResult; - } - - static @NonNull PlatformBitmapAsset fromList(@NonNull ArrayList pigeonVar_list) { - PlatformBitmapAsset pigeonResult = new PlatformBitmapAsset(); - Object name = pigeonVar_list.get(0); - pigeonResult.setName((String) name); - Object pkg = pigeonVar_list.get(1); - pigeonResult.setPkg((String) pkg); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [AssetImageBitmap]. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-fromasset-string-assetname - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmapAssetImage { - private @NonNull String name; - - public @NonNull String getName() { - return name; - } - - public void setName(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"name\" is null."); - } - this.name = setterArg; - } - - private @NonNull Double scale; - - public @NonNull Double getScale() { - return scale; - } - - public void setScale(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"scale\" is null."); - } - this.scale = setterArg; - } - - private @Nullable PlatformDoublePair size; - - public @Nullable PlatformDoublePair getSize() { - return size; - } - - public void setSize(@Nullable PlatformDoublePair setterArg) { - this.size = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformBitmapAssetImage() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmapAssetImage that = (PlatformBitmapAssetImage) o; - return name.equals(that.name) && scale.equals(that.scale) && Objects.equals(size, that.size); - } - - @Override - public int hashCode() { - return Objects.hash(name, scale, size); - } - - public static final class Builder { - - private @Nullable String name; - - @CanIgnoreReturnValue - public @NonNull Builder setName(@NonNull String setterArg) { - this.name = setterArg; - return this; - } - - private @Nullable Double scale; - - @CanIgnoreReturnValue - public @NonNull Builder setScale(@NonNull Double setterArg) { - this.scale = setterArg; - return this; - } - - private @Nullable PlatformDoublePair size; - - @CanIgnoreReturnValue - public @NonNull Builder setSize(@Nullable PlatformDoublePair setterArg) { - this.size = setterArg; - return this; - } - - public @NonNull PlatformBitmapAssetImage build() { - PlatformBitmapAssetImage pigeonReturn = new PlatformBitmapAssetImage(); - pigeonReturn.setName(name); - pigeonReturn.setScale(scale); - pigeonReturn.setSize(size); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(name); - toListResult.add(scale); - toListResult.add(size); - return toListResult; - } - - static @NonNull PlatformBitmapAssetImage fromList(@NonNull ArrayList pigeonVar_list) { - PlatformBitmapAssetImage pigeonResult = new PlatformBitmapAssetImage(); - Object name = pigeonVar_list.get(0); - pigeonResult.setName((String) name); - Object scale = pigeonVar_list.get(1); - pigeonResult.setScale((Double) scale); - Object size = pigeonVar_list.get(2); - pigeonResult.setSize((PlatformDoublePair) size); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [AssetMapBitmap]. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-fromasset-string-assetname - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmapAssetMap { - private @NonNull String assetName; - - public @NonNull String getAssetName() { - return assetName; - } - - public void setAssetName(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"assetName\" is null."); - } - this.assetName = setterArg; - } - - private @NonNull PlatformMapBitmapScaling bitmapScaling; - - public @NonNull PlatformMapBitmapScaling getBitmapScaling() { - return bitmapScaling; - } - - public void setBitmapScaling(@NonNull PlatformMapBitmapScaling setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bitmapScaling\" is null."); - } - this.bitmapScaling = setterArg; - } - - private @NonNull Double imagePixelRatio; - - public @NonNull Double getImagePixelRatio() { - return imagePixelRatio; - } - - public void setImagePixelRatio(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"imagePixelRatio\" is null."); - } - this.imagePixelRatio = setterArg; - } - - private @Nullable Double width; - - public @Nullable Double getWidth() { - return width; - } - - public void setWidth(@Nullable Double setterArg) { - this.width = setterArg; - } - - private @Nullable Double height; - - public @Nullable Double getHeight() { - return height; - } - - public void setHeight(@Nullable Double setterArg) { - this.height = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformBitmapAssetMap() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmapAssetMap that = (PlatformBitmapAssetMap) o; - return assetName.equals(that.assetName) - && bitmapScaling.equals(that.bitmapScaling) - && imagePixelRatio.equals(that.imagePixelRatio) - && Objects.equals(width, that.width) - && Objects.equals(height, that.height); - } - - @Override - public int hashCode() { - return Objects.hash(assetName, bitmapScaling, imagePixelRatio, width, height); - } - - public static final class Builder { - - private @Nullable String assetName; - - @CanIgnoreReturnValue - public @NonNull Builder setAssetName(@NonNull String setterArg) { - this.assetName = setterArg; - return this; - } - - private @Nullable PlatformMapBitmapScaling bitmapScaling; - - @CanIgnoreReturnValue - public @NonNull Builder setBitmapScaling(@NonNull PlatformMapBitmapScaling setterArg) { - this.bitmapScaling = setterArg; - return this; - } - - private @Nullable Double imagePixelRatio; - - @CanIgnoreReturnValue - public @NonNull Builder setImagePixelRatio(@NonNull Double setterArg) { - this.imagePixelRatio = setterArg; - return this; - } - - private @Nullable Double width; - - @CanIgnoreReturnValue - public @NonNull Builder setWidth(@Nullable Double setterArg) { - this.width = setterArg; - return this; - } - - private @Nullable Double height; - - @CanIgnoreReturnValue - public @NonNull Builder setHeight(@Nullable Double setterArg) { - this.height = setterArg; - return this; - } - - public @NonNull PlatformBitmapAssetMap build() { - PlatformBitmapAssetMap pigeonReturn = new PlatformBitmapAssetMap(); - pigeonReturn.setAssetName(assetName); - pigeonReturn.setBitmapScaling(bitmapScaling); - pigeonReturn.setImagePixelRatio(imagePixelRatio); - pigeonReturn.setWidth(width); - pigeonReturn.setHeight(height); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(5); - toListResult.add(assetName); - toListResult.add(bitmapScaling); - toListResult.add(imagePixelRatio); - toListResult.add(width); - toListResult.add(height); - return toListResult; - } - - static @NonNull PlatformBitmapAssetMap fromList(@NonNull ArrayList pigeonVar_list) { - PlatformBitmapAssetMap pigeonResult = new PlatformBitmapAssetMap(); - Object assetName = pigeonVar_list.get(0); - pigeonResult.setAssetName((String) assetName); - Object bitmapScaling = pigeonVar_list.get(1); - pigeonResult.setBitmapScaling((PlatformMapBitmapScaling) bitmapScaling); - Object imagePixelRatio = pigeonVar_list.get(2); - pigeonResult.setImagePixelRatio((Double) imagePixelRatio); - Object width = pigeonVar_list.get(3); - pigeonResult.setWidth((Double) width); - Object height = pigeonVar_list.get(4); - pigeonResult.setHeight((Double) height); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [BytesMapBitmap]. See - * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-frombitmap-bitmap-image - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmapBytesMap { - private @NonNull byte[] byteData; - - public @NonNull byte[] getByteData() { - return byteData; - } - - public void setByteData(@NonNull byte[] setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"byteData\" is null."); - } - this.byteData = setterArg; - } - - private @NonNull PlatformMapBitmapScaling bitmapScaling; - - public @NonNull PlatformMapBitmapScaling getBitmapScaling() { - return bitmapScaling; - } - - public void setBitmapScaling(@NonNull PlatformMapBitmapScaling setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"bitmapScaling\" is null."); - } - this.bitmapScaling = setterArg; - } - - private @NonNull Double imagePixelRatio; - - public @NonNull Double getImagePixelRatio() { - return imagePixelRatio; - } - - public void setImagePixelRatio(@NonNull Double setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"imagePixelRatio\" is null."); - } - this.imagePixelRatio = setterArg; - } - - private @Nullable Double width; - - public @Nullable Double getWidth() { - return width; - } - - public void setWidth(@Nullable Double setterArg) { - this.width = setterArg; - } - - private @Nullable Double height; - - public @Nullable Double getHeight() { - return height; - } - - public void setHeight(@Nullable Double setterArg) { - this.height = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformBitmapBytesMap() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmapBytesMap that = (PlatformBitmapBytesMap) o; - return Arrays.equals(byteData, that.byteData) - && bitmapScaling.equals(that.bitmapScaling) - && imagePixelRatio.equals(that.imagePixelRatio) - && Objects.equals(width, that.width) - && Objects.equals(height, that.height); - } - - @Override - public int hashCode() { - int pigeonVar_result = Objects.hash(bitmapScaling, imagePixelRatio, width, height); - pigeonVar_result = 31 * pigeonVar_result + Arrays.hashCode(byteData); - return pigeonVar_result; - } - - public static final class Builder { - - private @Nullable byte[] byteData; - - @CanIgnoreReturnValue - public @NonNull Builder setByteData(@NonNull byte[] setterArg) { - this.byteData = setterArg; - return this; - } - - private @Nullable PlatformMapBitmapScaling bitmapScaling; - - @CanIgnoreReturnValue - public @NonNull Builder setBitmapScaling(@NonNull PlatformMapBitmapScaling setterArg) { - this.bitmapScaling = setterArg; - return this; - } - - private @Nullable Double imagePixelRatio; - - @CanIgnoreReturnValue - public @NonNull Builder setImagePixelRatio(@NonNull Double setterArg) { - this.imagePixelRatio = setterArg; - return this; - } - - private @Nullable Double width; - - @CanIgnoreReturnValue - public @NonNull Builder setWidth(@Nullable Double setterArg) { - this.width = setterArg; - return this; - } - - private @Nullable Double height; - - @CanIgnoreReturnValue - public @NonNull Builder setHeight(@Nullable Double setterArg) { - this.height = setterArg; - return this; - } - - public @NonNull PlatformBitmapBytesMap build() { - PlatformBitmapBytesMap pigeonReturn = new PlatformBitmapBytesMap(); - pigeonReturn.setByteData(byteData); - pigeonReturn.setBitmapScaling(bitmapScaling); - pigeonReturn.setImagePixelRatio(imagePixelRatio); - pigeonReturn.setWidth(width); - pigeonReturn.setHeight(height); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(5); - toListResult.add(byteData); - toListResult.add(bitmapScaling); - toListResult.add(imagePixelRatio); - toListResult.add(width); - toListResult.add(height); - return toListResult; - } - - static @NonNull PlatformBitmapBytesMap fromList(@NonNull ArrayList pigeonVar_list) { - PlatformBitmapBytesMap pigeonResult = new PlatformBitmapBytesMap(); - Object byteData = pigeonVar_list.get(0); - pigeonResult.setByteData((byte[]) byteData); - Object bitmapScaling = pigeonVar_list.get(1); - pigeonResult.setBitmapScaling((PlatformMapBitmapScaling) bitmapScaling); - Object imagePixelRatio = pigeonVar_list.get(2); - pigeonResult.setImagePixelRatio((Double) imagePixelRatio); - Object width = pigeonVar_list.get(3); - pigeonResult.setWidth((Double) width); - Object height = pigeonVar_list.get(4); - pigeonResult.setHeight((Double) height); - return pigeonResult; - } - } - - /** - * Pigeon equivalent of [PinConfig]. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformBitmapPinConfig { - private @Nullable PlatformColor backgroundColor; - - public @Nullable PlatformColor getBackgroundColor() { - return backgroundColor; - } - - public void setBackgroundColor(@Nullable PlatformColor setterArg) { - this.backgroundColor = setterArg; - } - - private @Nullable PlatformColor borderColor; - - public @Nullable PlatformColor getBorderColor() { - return borderColor; - } - - public void setBorderColor(@Nullable PlatformColor setterArg) { - this.borderColor = setterArg; - } - - private @Nullable PlatformColor glyphColor; - - public @Nullable PlatformColor getGlyphColor() { - return glyphColor; - } - - public void setGlyphColor(@Nullable PlatformColor setterArg) { - this.glyphColor = setterArg; - } - - private @Nullable PlatformBitmap glyphBitmap; - - public @Nullable PlatformBitmap getGlyphBitmap() { - return glyphBitmap; - } - - public void setGlyphBitmap(@Nullable PlatformBitmap setterArg) { - this.glyphBitmap = setterArg; - } - - private @Nullable String glyphText; - - public @Nullable String getGlyphText() { - return glyphText; - } - - public void setGlyphText(@Nullable String setterArg) { - this.glyphText = setterArg; - } - - private @Nullable PlatformColor glyphTextColor; - - public @Nullable PlatformColor getGlyphTextColor() { - return glyphTextColor; - } - - public void setGlyphTextColor(@Nullable PlatformColor setterArg) { - this.glyphTextColor = setterArg; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformBitmapPinConfig that = (PlatformBitmapPinConfig) o; - return Objects.equals(backgroundColor, that.backgroundColor) - && Objects.equals(borderColor, that.borderColor) - && Objects.equals(glyphColor, that.glyphColor) - && Objects.equals(glyphBitmap, that.glyphBitmap) - && Objects.equals(glyphText, that.glyphText) - && Objects.equals(glyphTextColor, that.glyphTextColor); - } - - @Override - public int hashCode() { - return Objects.hash( - backgroundColor, borderColor, glyphColor, glyphBitmap, glyphText, glyphTextColor); - } - - public static final class Builder { - - private @Nullable PlatformColor backgroundColor; - - @CanIgnoreReturnValue - public @NonNull Builder setBackgroundColor(@Nullable PlatformColor setterArg) { - this.backgroundColor = setterArg; - return this; - } - - private @Nullable PlatformColor borderColor; - - @CanIgnoreReturnValue - public @NonNull Builder setBorderColor(@Nullable PlatformColor setterArg) { - this.borderColor = setterArg; - return this; - } - - private @Nullable PlatformColor glyphColor; - - @CanIgnoreReturnValue - public @NonNull Builder setGlyphColor(@Nullable PlatformColor setterArg) { - this.glyphColor = setterArg; - return this; - } - - private @Nullable PlatformBitmap glyphBitmap; - - @CanIgnoreReturnValue - public @NonNull Builder setGlyphBitmap(@Nullable PlatformBitmap setterArg) { - this.glyphBitmap = setterArg; - return this; - } - - private @Nullable String glyphText; - - @CanIgnoreReturnValue - public @NonNull Builder setGlyphText(@Nullable String setterArg) { - this.glyphText = setterArg; - return this; - } - - private @Nullable PlatformColor glyphTextColor; - - @CanIgnoreReturnValue - public @NonNull Builder setGlyphTextColor(@Nullable PlatformColor setterArg) { - this.glyphTextColor = setterArg; - return this; - } - - public @NonNull PlatformBitmapPinConfig build() { - PlatformBitmapPinConfig pigeonReturn = new PlatformBitmapPinConfig(); - pigeonReturn.setBackgroundColor(backgroundColor); - pigeonReturn.setBorderColor(borderColor); - pigeonReturn.setGlyphColor(glyphColor); - pigeonReturn.setGlyphBitmap(glyphBitmap); - pigeonReturn.setGlyphText(glyphText); - pigeonReturn.setGlyphTextColor(glyphTextColor); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(6); - toListResult.add(backgroundColor); - toListResult.add(borderColor); - toListResult.add(glyphColor); - toListResult.add(glyphBitmap); - toListResult.add(glyphText); - toListResult.add(glyphTextColor); - return toListResult; - } - - static @NonNull PlatformBitmapPinConfig fromList(@NonNull ArrayList pigeonVar_list) { - PlatformBitmapPinConfig pigeonResult = new PlatformBitmapPinConfig(); - Object backgroundColor = pigeonVar_list.get(0); - pigeonResult.setBackgroundColor((PlatformColor) backgroundColor); - Object borderColor = pigeonVar_list.get(1); - pigeonResult.setBorderColor((PlatformColor) borderColor); - Object glyphColor = pigeonVar_list.get(2); - pigeonResult.setGlyphColor((PlatformColor) glyphColor); - Object glyphBitmap = pigeonVar_list.get(3); - pigeonResult.setGlyphBitmap((PlatformBitmap) glyphBitmap); - Object glyphText = pigeonVar_list.get(4); - pigeonResult.setGlyphText((String) glyphText); - Object glyphTextColor = pigeonVar_list.get(5); - pigeonResult.setGlyphTextColor((PlatformColor) glyphTextColor); - return pigeonResult; - } - } - - private static class PigeonCodec extends StandardMessageCodec { - public static final PigeonCodec INSTANCE = new PigeonCodec(); - - private PigeonCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : PlatformMapType.values()[((Long) value).intValue()]; - } - case (byte) 130: - { - Object value = readValue(buffer); - return value == null ? null : PlatformRendererType.values()[((Long) value).intValue()]; - } - case (byte) 131: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformMarkerCollisionBehavior.values()[((Long) value).intValue()]; - } - case (byte) 132: - { - Object value = readValue(buffer); - return value == null ? null : PlatformJointType.values()[((Long) value).intValue()]; - } - case (byte) 133: - { - Object value = readValue(buffer); - return value == null ? null : PlatformCapType.values()[((Long) value).intValue()]; - } - case (byte) 134: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformPatternItemType.values()[((Long) value).intValue()]; - } - case (byte) 135: - { - Object value = readValue(buffer); - return value == null ? null : PlatformMarkerType.values()[((Long) value).intValue()]; - } - case (byte) 136: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformMapBitmapScaling.values()[((Long) value).intValue()]; - } - case (byte) 137: - return PlatformCameraPosition.fromList((ArrayList) readValue(buffer)); - case (byte) 138: - return PlatformCameraUpdate.fromList((ArrayList) readValue(buffer)); - case (byte) 139: - return PlatformCameraUpdateNewCameraPosition.fromList( - (ArrayList) readValue(buffer)); - case (byte) 140: - return PlatformCameraUpdateNewLatLng.fromList((ArrayList) readValue(buffer)); - case (byte) 141: - return PlatformCameraUpdateNewLatLngBounds.fromList( - (ArrayList) readValue(buffer)); - case (byte) 142: - return PlatformCameraUpdateNewLatLngZoom.fromList((ArrayList) readValue(buffer)); - case (byte) 143: - return PlatformCameraUpdateScrollBy.fromList((ArrayList) readValue(buffer)); - case (byte) 144: - return PlatformCameraUpdateZoomBy.fromList((ArrayList) readValue(buffer)); - case (byte) 145: - return PlatformCameraUpdateZoom.fromList((ArrayList) readValue(buffer)); - case (byte) 146: - return PlatformCameraUpdateZoomTo.fromList((ArrayList) readValue(buffer)); - case (byte) 147: - return PlatformCircle.fromList((ArrayList) readValue(buffer)); - case (byte) 148: - return PlatformHeatmap.fromList((ArrayList) readValue(buffer)); - case (byte) 149: - return PlatformHeatmapGradient.fromList((ArrayList) readValue(buffer)); - case (byte) 150: - return PlatformWeightedLatLng.fromList((ArrayList) readValue(buffer)); - case (byte) 151: - return PlatformClusterManager.fromList((ArrayList) readValue(buffer)); - case (byte) 152: - return PlatformDoublePair.fromList((ArrayList) readValue(buffer)); - case (byte) 153: - return PlatformColor.fromList((ArrayList) readValue(buffer)); - case (byte) 154: - return PlatformInfoWindow.fromList((ArrayList) readValue(buffer)); - case (byte) 155: - return PlatformMarker.fromList((ArrayList) readValue(buffer)); - case (byte) 156: - return PlatformPolygon.fromList((ArrayList) readValue(buffer)); - case (byte) 157: - return PlatformPolyline.fromList((ArrayList) readValue(buffer)); - case (byte) 158: - return PlatformCap.fromList((ArrayList) readValue(buffer)); - case (byte) 159: - return PlatformPatternItem.fromList((ArrayList) readValue(buffer)); - case (byte) 160: - return PlatformTile.fromList((ArrayList) readValue(buffer)); - case (byte) 161: - return PlatformTileOverlay.fromList((ArrayList) readValue(buffer)); - case (byte) 162: - return PlatformEdgeInsets.fromList((ArrayList) readValue(buffer)); - case (byte) 163: - return PlatformLatLng.fromList((ArrayList) readValue(buffer)); - case (byte) 164: - return PlatformLatLngBounds.fromList((ArrayList) readValue(buffer)); - case (byte) 165: - return PlatformCluster.fromList((ArrayList) readValue(buffer)); - case (byte) 166: - return PlatformGroundOverlay.fromList((ArrayList) readValue(buffer)); - case (byte) 167: - return PlatformCameraTargetBounds.fromList((ArrayList) readValue(buffer)); - case (byte) 168: - return PlatformMapViewCreationParams.fromList((ArrayList) readValue(buffer)); - case (byte) 169: - return PlatformMapConfiguration.fromList((ArrayList) readValue(buffer)); - case (byte) 170: - return PlatformPoint.fromList((ArrayList) readValue(buffer)); - case (byte) 171: - return PlatformTileLayer.fromList((ArrayList) readValue(buffer)); - case (byte) 172: - return PlatformZoomRange.fromList((ArrayList) readValue(buffer)); - case (byte) 173: - return PlatformBitmap.fromList((ArrayList) readValue(buffer)); - case (byte) 174: - return PlatformBitmapDefaultMarker.fromList((ArrayList) readValue(buffer)); - case (byte) 175: - return PlatformBitmapBytes.fromList((ArrayList) readValue(buffer)); - case (byte) 176: - return PlatformBitmapAsset.fromList((ArrayList) readValue(buffer)); - case (byte) 177: - return PlatformBitmapAssetImage.fromList((ArrayList) readValue(buffer)); - case (byte) 178: - return PlatformBitmapAssetMap.fromList((ArrayList) readValue(buffer)); - case (byte) 179: - return PlatformBitmapBytesMap.fromList((ArrayList) readValue(buffer)); - case (byte) 180: - return PlatformBitmapPinConfig.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof PlatformMapType) { - stream.write(129); - writeValue(stream, value == null ? null : ((PlatformMapType) value).index); - } else if (value instanceof PlatformRendererType) { - stream.write(130); - writeValue(stream, value == null ? null : ((PlatformRendererType) value).index); - } else if (value instanceof PlatformMarkerCollisionBehavior) { - stream.write(131); - writeValue(stream, value == null ? null : ((PlatformMarkerCollisionBehavior) value).index); - } else if (value instanceof PlatformJointType) { - stream.write(132); - writeValue(stream, value == null ? null : ((PlatformJointType) value).index); - } else if (value instanceof PlatformCapType) { - stream.write(133); - writeValue(stream, value == null ? null : ((PlatformCapType) value).index); - } else if (value instanceof PlatformPatternItemType) { - stream.write(134); - writeValue(stream, value == null ? null : ((PlatformPatternItemType) value).index); - } else if (value instanceof PlatformMarkerType) { - stream.write(135); - writeValue(stream, value == null ? null : ((PlatformMarkerType) value).index); - } else if (value instanceof PlatformMapBitmapScaling) { - stream.write(136); - writeValue(stream, value == null ? null : ((PlatformMapBitmapScaling) value).index); - } else if (value instanceof PlatformCameraPosition) { - stream.write(137); - writeValue(stream, ((PlatformCameraPosition) value).toList()); - } else if (value instanceof PlatformCameraUpdate) { - stream.write(138); - writeValue(stream, ((PlatformCameraUpdate) value).toList()); - } else if (value instanceof PlatformCameraUpdateNewCameraPosition) { - stream.write(139); - writeValue(stream, ((PlatformCameraUpdateNewCameraPosition) value).toList()); - } else if (value instanceof PlatformCameraUpdateNewLatLng) { - stream.write(140); - writeValue(stream, ((PlatformCameraUpdateNewLatLng) value).toList()); - } else if (value instanceof PlatformCameraUpdateNewLatLngBounds) { - stream.write(141); - writeValue(stream, ((PlatformCameraUpdateNewLatLngBounds) value).toList()); - } else if (value instanceof PlatformCameraUpdateNewLatLngZoom) { - stream.write(142); - writeValue(stream, ((PlatformCameraUpdateNewLatLngZoom) value).toList()); - } else if (value instanceof PlatformCameraUpdateScrollBy) { - stream.write(143); - writeValue(stream, ((PlatformCameraUpdateScrollBy) value).toList()); - } else if (value instanceof PlatformCameraUpdateZoomBy) { - stream.write(144); - writeValue(stream, ((PlatformCameraUpdateZoomBy) value).toList()); - } else if (value instanceof PlatformCameraUpdateZoom) { - stream.write(145); - writeValue(stream, ((PlatformCameraUpdateZoom) value).toList()); - } else if (value instanceof PlatformCameraUpdateZoomTo) { - stream.write(146); - writeValue(stream, ((PlatformCameraUpdateZoomTo) value).toList()); - } else if (value instanceof PlatformCircle) { - stream.write(147); - writeValue(stream, ((PlatformCircle) value).toList()); - } else if (value instanceof PlatformHeatmap) { - stream.write(148); - writeValue(stream, ((PlatformHeatmap) value).toList()); - } else if (value instanceof PlatformHeatmapGradient) { - stream.write(149); - writeValue(stream, ((PlatformHeatmapGradient) value).toList()); - } else if (value instanceof PlatformWeightedLatLng) { - stream.write(150); - writeValue(stream, ((PlatformWeightedLatLng) value).toList()); - } else if (value instanceof PlatformClusterManager) { - stream.write(151); - writeValue(stream, ((PlatformClusterManager) value).toList()); - } else if (value instanceof PlatformDoublePair) { - stream.write(152); - writeValue(stream, ((PlatformDoublePair) value).toList()); - } else if (value instanceof PlatformColor) { - stream.write(153); - writeValue(stream, ((PlatformColor) value).toList()); - } else if (value instanceof PlatformInfoWindow) { - stream.write(154); - writeValue(stream, ((PlatformInfoWindow) value).toList()); - } else if (value instanceof PlatformMarker) { - stream.write(155); - writeValue(stream, ((PlatformMarker) value).toList()); - } else if (value instanceof PlatformPolygon) { - stream.write(156); - writeValue(stream, ((PlatformPolygon) value).toList()); - } else if (value instanceof PlatformPolyline) { - stream.write(157); - writeValue(stream, ((PlatformPolyline) value).toList()); - } else if (value instanceof PlatformCap) { - stream.write(158); - writeValue(stream, ((PlatformCap) value).toList()); - } else if (value instanceof PlatformPatternItem) { - stream.write(159); - writeValue(stream, ((PlatformPatternItem) value).toList()); - } else if (value instanceof PlatformTile) { - stream.write(160); - writeValue(stream, ((PlatformTile) value).toList()); - } else if (value instanceof PlatformTileOverlay) { - stream.write(161); - writeValue(stream, ((PlatformTileOverlay) value).toList()); - } else if (value instanceof PlatformEdgeInsets) { - stream.write(162); - writeValue(stream, ((PlatformEdgeInsets) value).toList()); - } else if (value instanceof PlatformLatLng) { - stream.write(163); - writeValue(stream, ((PlatformLatLng) value).toList()); - } else if (value instanceof PlatformLatLngBounds) { - stream.write(164); - writeValue(stream, ((PlatformLatLngBounds) value).toList()); - } else if (value instanceof PlatformCluster) { - stream.write(165); - writeValue(stream, ((PlatformCluster) value).toList()); - } else if (value instanceof PlatformGroundOverlay) { - stream.write(166); - writeValue(stream, ((PlatformGroundOverlay) value).toList()); - } else if (value instanceof PlatformCameraTargetBounds) { - stream.write(167); - writeValue(stream, ((PlatformCameraTargetBounds) value).toList()); - } else if (value instanceof PlatformMapViewCreationParams) { - stream.write(168); - writeValue(stream, ((PlatformMapViewCreationParams) value).toList()); - } else if (value instanceof PlatformMapConfiguration) { - stream.write(169); - writeValue(stream, ((PlatformMapConfiguration) value).toList()); - } else if (value instanceof PlatformPoint) { - stream.write(170); - writeValue(stream, ((PlatformPoint) value).toList()); - } else if (value instanceof PlatformTileLayer) { - stream.write(171); - writeValue(stream, ((PlatformTileLayer) value).toList()); - } else if (value instanceof PlatformZoomRange) { - stream.write(172); - writeValue(stream, ((PlatformZoomRange) value).toList()); - } else if (value instanceof PlatformBitmap) { - stream.write(173); - writeValue(stream, ((PlatformBitmap) value).toList()); - } else if (value instanceof PlatformBitmapDefaultMarker) { - stream.write(174); - writeValue(stream, ((PlatformBitmapDefaultMarker) value).toList()); - } else if (value instanceof PlatformBitmapBytes) { - stream.write(175); - writeValue(stream, ((PlatformBitmapBytes) value).toList()); - } else if (value instanceof PlatformBitmapAsset) { - stream.write(176); - writeValue(stream, ((PlatformBitmapAsset) value).toList()); - } else if (value instanceof PlatformBitmapAssetImage) { - stream.write(177); - writeValue(stream, ((PlatformBitmapAssetImage) value).toList()); - } else if (value instanceof PlatformBitmapAssetMap) { - stream.write(178); - writeValue(stream, ((PlatformBitmapAssetMap) value).toList()); - } else if (value instanceof PlatformBitmapBytesMap) { - stream.write(179); - writeValue(stream, ((PlatformBitmapBytesMap) value).toList()); - } else if (value instanceof PlatformBitmapPinConfig) { - stream.write(180); - writeValue(stream, ((PlatformBitmapPinConfig) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - - /** Asynchronous error handling return type for non-nullable API method returns. */ - public interface Result { - /** Success case callback method for handling returns. */ - void success(@NonNull T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for nullable API method returns. */ - public interface NullableResult { - /** Success case callback method for handling returns. */ - void success(@Nullable T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for void API method returns. */ - public interface VoidResult { - /** Success case callback method for handling returns. */ - void success(); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** - * Interface for non-test interactions with the native SDK. - * - *

For test-only state queries, see [MapsInspectorApi]. - * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. - */ - public interface MapsApi { - /** Returns once the map instance is available. */ - void waitForMap(@NonNull VoidResult result); - /** - * Updates the map's configuration options. - * - *

Only non-null configuration values will result in updates; options with null values will - * remain unchanged. - */ - void updateMapConfiguration(@NonNull PlatformMapConfiguration configuration); - /** Updates the set of circles on the map. */ - void updateCircles( - @NonNull List toAdd, - @NonNull List toChange, - @NonNull List idsToRemove); - /** Updates the set of heatmaps on the map. */ - void updateHeatmaps( - @NonNull List toAdd, - @NonNull List toChange, - @NonNull List idsToRemove); - /** Updates the set of custer managers for clusters on the map. */ - void updateClusterManagers( - @NonNull List toAdd, @NonNull List idsToRemove); - /** Updates the set of markers on the map. */ - void updateMarkers( - @NonNull List toAdd, - @NonNull List toChange, - @NonNull List idsToRemove); - /** Updates the set of polygonss on the map. */ - void updatePolygons( - @NonNull List toAdd, - @NonNull List toChange, - @NonNull List idsToRemove); - /** Updates the set of polylines on the map. */ - void updatePolylines( - @NonNull List toAdd, - @NonNull List toChange, - @NonNull List idsToRemove); - /** Updates the set of tile overlays on the map. */ - void updateTileOverlays( - @NonNull List toAdd, - @NonNull List toChange, - @NonNull List idsToRemove); - /** Updates the set of ground overlays on the map. */ - void updateGroundOverlays( - @NonNull List toAdd, - @NonNull List toChange, - @NonNull List idsToRemove); - /** Gets the screen coordinate for the given map location. */ - @NonNull - PlatformPoint getScreenCoordinate(@NonNull PlatformLatLng latLng); - /** Gets the map location for the given screen coordinate. */ - @NonNull - PlatformLatLng getLatLng(@NonNull PlatformPoint screenCoordinate); - /** Gets the map region currently displayed on the map. */ - @NonNull - PlatformLatLngBounds getVisibleRegion(); - /** Moves the camera according to [cameraUpdate] immediately, with no animation. */ - void moveCamera(@NonNull PlatformCameraUpdate cameraUpdate); - /** - * Moves the camera according to [cameraUpdate], animating the update using a duration in - * milliseconds if provided. - */ - void animateCamera( - @NonNull PlatformCameraUpdate cameraUpdate, @Nullable Long durationMilliseconds); - /** Gets the current map zoom level. */ - @NonNull - Double getZoomLevel(); - /** Show the info window for the marker with the given ID. */ - void showInfoWindow(@NonNull String markerId); - /** Hide the info window for the marker with the given ID. */ - void hideInfoWindow(@NonNull String markerId); - /** Returns true if the marker with the given ID is currently displaying its info window. */ - @NonNull - Boolean isInfoWindowShown(@NonNull String markerId); - /** - * Sets the style to the given map style string, where an empty string indicates that the style - * should be cleared. - * - *

Returns false if there was an error setting the style, such as an invalid style string. - */ - @NonNull - Boolean setStyle(@NonNull String style); - /** - * Returns true if the last attempt to set a style, either via initial map style or setMapStyle, - * succeeded. - * - *

This allows checking asynchronously for initial style failures, as there is no way to - * return failures from map initialization. - */ - @NonNull - Boolean didLastStyleSucceed(); - /** - * Returns true if this map supports advanced markers. - * - *

This allows checking if the map supports advanced markers before attempting to use them. - */ - @NonNull - Boolean isAdvancedMarkersAvailable(); - /** Clears the cache of tiles previously requseted from the tile provider. */ - void clearTileCache(@NonNull String tileOverlayId); - /** Takes a snapshot of the map and returns its image data. */ - void takeSnapshot(@NonNull Result result); - - /** The codec used by MapsApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** Sets up an instance of `MapsApi` to handle messages through the `binaryMessenger`. */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable MapsApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MapsApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.waitForMap" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - VoidResult resultCallback = - new VoidResult() { - public void success() { - wrapped.add(0, null); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.waitForMap(resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateMapConfiguration" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformMapConfiguration configurationArg = (PlatformMapConfiguration) args.get(0); - try { - api.updateMapConfiguration(configurationArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateCircles" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List toChangeArg = (List) args.get(1); - List idsToRemoveArg = (List) args.get(2); - try { - api.updateCircles(toAddArg, toChangeArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateHeatmaps" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List toChangeArg = (List) args.get(1); - List idsToRemoveArg = (List) args.get(2); - try { - api.updateHeatmaps(toAddArg, toChangeArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateClusterManagers" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List idsToRemoveArg = (List) args.get(1); - try { - api.updateClusterManagers(toAddArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateMarkers" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List toChangeArg = (List) args.get(1); - List idsToRemoveArg = (List) args.get(2); - try { - api.updateMarkers(toAddArg, toChangeArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updatePolygons" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List toChangeArg = (List) args.get(1); - List idsToRemoveArg = (List) args.get(2); - try { - api.updatePolygons(toAddArg, toChangeArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updatePolylines" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List toChangeArg = (List) args.get(1); - List idsToRemoveArg = (List) args.get(2); - try { - api.updatePolylines(toAddArg, toChangeArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateTileOverlays" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List toChangeArg = (List) args.get(1); - List idsToRemoveArg = (List) args.get(2); - try { - api.updateTileOverlays(toAddArg, toChangeArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateGroundOverlays" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - List toAddArg = (List) args.get(0); - List toChangeArg = (List) args.get(1); - List idsToRemoveArg = (List) args.get(2); - try { - api.updateGroundOverlays(toAddArg, toChangeArg, idsToRemoveArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getScreenCoordinate" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformLatLng latLngArg = (PlatformLatLng) args.get(0); - try { - PlatformPoint output = api.getScreenCoordinate(latLngArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getLatLng" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformPoint screenCoordinateArg = (PlatformPoint) args.get(0); - try { - PlatformLatLng output = api.getLatLng(screenCoordinateArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getVisibleRegion" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - PlatformLatLngBounds output = api.getVisibleRegion(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.moveCamera" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformCameraUpdate cameraUpdateArg = (PlatformCameraUpdate) args.get(0); - try { - api.moveCamera(cameraUpdateArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.animateCamera" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformCameraUpdate cameraUpdateArg = (PlatformCameraUpdate) args.get(0); - Long durationMillisecondsArg = (Long) args.get(1); - try { - api.animateCamera(cameraUpdateArg, durationMillisecondsArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getZoomLevel" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Double output = api.getZoomLevel(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.showInfoWindow" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String markerIdArg = (String) args.get(0); - try { - api.showInfoWindow(markerIdArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.hideInfoWindow" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String markerIdArg = (String) args.get(0); - try { - api.hideInfoWindow(markerIdArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.isInfoWindowShown" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String markerIdArg = (String) args.get(0); - try { - Boolean output = api.isInfoWindowShown(markerIdArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.setStyle" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String styleArg = (String) args.get(0); - try { - Boolean output = api.setStyle(styleArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.didLastStyleSucceed" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.didLastStyleSucceed(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.isAdvancedMarkersAvailable" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isAdvancedMarkersAvailable(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.clearTileCache" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String tileOverlayIdArg = (String) args.get(0); - try { - api.clearTileCache(tileOverlayIdArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.takeSnapshot" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - Result resultCallback = - new Result() { - public void success(byte[] result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.takeSnapshot(resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ - public static class MapsCallbackApi { - private final @NonNull BinaryMessenger binaryMessenger; - private final String messageChannelSuffix; - - public MapsCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { - this(argBinaryMessenger, ""); - } - - public MapsCallbackApi( - @NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { - this.binaryMessenger = argBinaryMessenger; - this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - } - - /** Public interface for sending reply. The codec used by MapsCallbackApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** Called when the map camera starts moving. */ - public void onCameraMoveStarted(@NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMoveStarted" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - null, - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when the map camera moves. */ - public void onCameraMove( - @NonNull PlatformCameraPosition cameraPositionArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMove" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(cameraPositionArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when the map camera stops moving. */ - public void onCameraIdle(@NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraIdle" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - null, - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when the map, not a specifc map object, is tapped. */ - public void onTap(@NonNull PlatformLatLng positionArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(positionArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when the map, not a specifc map object, is long pressed. */ - public void onLongPress(@NonNull PlatformLatLng positionArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onLongPress" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(positionArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a marker is tapped. */ - public void onMarkerTap(@NonNull String markerIdArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(markerIdArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a marker drag starts. */ - public void onMarkerDragStart( - @NonNull String markerIdArg, - @NonNull PlatformLatLng positionArg, - @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragStart" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Arrays.asList(markerIdArg, positionArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a marker drag updates. */ - public void onMarkerDrag( - @NonNull String markerIdArg, - @NonNull PlatformLatLng positionArg, - @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDrag" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Arrays.asList(markerIdArg, positionArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a marker drag ends. */ - public void onMarkerDragEnd( - @NonNull String markerIdArg, - @NonNull PlatformLatLng positionArg, - @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragEnd" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Arrays.asList(markerIdArg, positionArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a marker's info window is tapped. */ - public void onInfoWindowTap(@NonNull String markerIdArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onInfoWindowTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(markerIdArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a circle is tapped. */ - public void onCircleTap(@NonNull String circleIdArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCircleTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(circleIdArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a marker cluster is tapped. */ - public void onClusterTap(@NonNull PlatformCluster clusterArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onClusterTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(clusterArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a polygon is tapped. */ - public void onPolygonTap(@NonNull String polygonIdArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolygonTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(polygonIdArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a polyline is tapped. */ - public void onPolylineTap(@NonNull String polylineIdArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolylineTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(polylineIdArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called when a ground overlay is tapped. */ - public void onGroundOverlayTap(@NonNull String groundOverlayIdArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onGroundOverlayTap" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Collections.singletonList(groundOverlayIdArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else { - result.success(); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - /** Called to get data for a map tile. */ - public void getTileOverlayTile( - @NonNull String tileOverlayIdArg, - @NonNull PlatformPoint locationArg, - @NonNull Long zoomArg, - @NonNull Result result) { - final String channelName = - "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.getTileOverlayTile" - + messageChannelSuffix; - BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); - channel.send( - new ArrayList<>(Arrays.asList(tileOverlayIdArg, locationArg, zoomArg)), - channelReply -> { - if (channelReply instanceof List) { - List listReply = (List) channelReply; - if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); - } else if (listReply.get(0) == null) { - result.error( - new FlutterError( - "null-error", - "Flutter api returned null value for non-null return value.", - "")); - } else { - @SuppressWarnings("ConstantConditions") - PlatformTile output = (PlatformTile) listReply.get(0); - result.success(output); - } - } else { - result.error(createConnectionError(channelName)); - } - }); - } - } - /** - * Interface for global SDK initialization. - * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. - */ - public interface MapsInitializerApi { - /** - * Initializes the Google Maps SDK with the given renderer preference. - * - *

A null renderer preference will result in the default renderer. - * - *

Calling this more than once in the lifetime of an application will result in an error. - */ - void initializeWithPreferredRenderer( - @Nullable PlatformRendererType type, @NonNull Result result); - /** - * Attempts to trigger any thread-blocking work the Google Maps SDK normally does when a map is - * shown for the first time. - */ - void warmup(); - - /** The codec used by MapsInitializerApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** - * Sets up an instance of `MapsInitializerApi` to handle messages through the `binaryMessenger`. - */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable MapsInitializerApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MapsInitializerApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.initializeWithPreferredRenderer" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformRendererType typeArg = (PlatformRendererType) args.get(0); - Result resultCallback = - new Result() { - public void success(PlatformRendererType result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.initializeWithPreferredRenderer(typeArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.warmup" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.warmup(); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - /** - * Dummy interface to force generation of the platform view creation params, which are not used in - * any Pigeon calls, only the platform view creation call made internally by Flutter. - * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. - */ - public interface MapsPlatformViewApi { - - void createView(@Nullable PlatformMapViewCreationParams type); - - /** The codec used by MapsPlatformViewApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** - * Sets up an instance of `MapsPlatformViewApi` to handle messages through the - * `binaryMessenger`. - */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable MapsPlatformViewApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MapsPlatformViewApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsPlatformViewApi.createView" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformMapViewCreationParams typeArg = (PlatformMapViewCreationParams) args.get(0); - try { - api.createView(typeArg); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } - /** - * Inspector API only intended for use in integration tests. - * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. - */ - public interface MapsInspectorApi { - - @NonNull - Boolean areBuildingsEnabled(); - - @NonNull - Boolean areRotateGesturesEnabled(); - - @NonNull - Boolean areZoomControlsEnabled(); - - @NonNull - Boolean areScrollGesturesEnabled(); - - @NonNull - Boolean areTiltGesturesEnabled(); - - @NonNull - Boolean areZoomGesturesEnabled(); - - @NonNull - Boolean isCompassEnabled(); - - @Nullable - Boolean isLiteModeEnabled(); - - @NonNull - Boolean isMapToolbarEnabled(); - - @NonNull - Boolean isMyLocationButtonEnabled(); - - @NonNull - Boolean isTrafficEnabled(); - - @Nullable - PlatformTileLayer getTileOverlayInfo(@NonNull String tileOverlayId); - - @Nullable - PlatformGroundOverlay getGroundOverlayInfo(@NonNull String groundOverlayId); - - @NonNull - PlatformZoomRange getZoomRange(); - - @NonNull - List getClusters(@NonNull String clusterManagerId); - - @NonNull - PlatformCameraPosition getCameraPosition(); - - /** The codec used by MapsInspectorApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** - * Sets up an instance of `MapsInspectorApi` to handle messages through the `binaryMessenger`. - */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable MapsInspectorApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable MapsInspectorApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areBuildingsEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.areBuildingsEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areRotateGesturesEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.areRotateGesturesEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areZoomControlsEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.areZoomControlsEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areScrollGesturesEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.areScrollGesturesEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areTiltGesturesEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.areTiltGesturesEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areZoomGesturesEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.areZoomGesturesEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isCompassEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isCompassEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isLiteModeEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isLiteModeEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isMapToolbarEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isMapToolbarEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isMyLocationButtonEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isMyLocationButtonEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isTrafficEnabled" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isTrafficEnabled(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getTileOverlayInfo" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String tileOverlayIdArg = (String) args.get(0); - try { - PlatformTileLayer output = api.getTileOverlayInfo(tileOverlayIdArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getGroundOverlayInfo" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String groundOverlayIdArg = (String) args.get(0); - try { - PlatformGroundOverlay output = api.getGroundOverlayInfo(groundOverlayIdArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getZoomRange" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - PlatformZoomRange output = api.getZoomRange(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getClusters" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String clusterManagerIdArg = (String) args.get(0); - try { - List output = api.getClusters(clusterManagerIdArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getCameraPosition" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - PlatformCameraPosition output = api.getCameraPosition(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } -} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/NoOpVoidResult.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/NoOpVoidResult.java deleted file mode 100644 index 4281d8f57bec..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/NoOpVoidResult.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package io.flutter.plugins.googlemaps; - -import androidx.annotation.NonNull; - -/** - * Response handler for calls to Dart that don't require any error handling, such as event - * notifications where if the Dart side has been torn down, silently dropping the message is the - * desired behavior. - * - *

Longer term, any call using this is likely a good candidate to migrate to event channels. - */ -public class NoOpVoidResult implements Messages.VoidResult { - @Override - public void success() {} - - @Override - public void error(@NonNull Throwable error) {} -} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java index 07caafe9e6cb..92aac55f0456 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonBuilder.java @@ -55,8 +55,8 @@ public void setConsumeTapEvents(boolean consumeTapEvents) { } @Override - public void setGeodesic(boolean geodisc) { - polygonOptions.geodesic(geodisc); + public void setGeodesic(boolean geodesic) { + polygonOptions.geodesic(geodesic); } @Override diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonsController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonsController.java index 8a7296d2b4f5..5d2ceb5efa10 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonsController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolygonsController.java @@ -8,10 +8,11 @@ import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.Polygon; import com.google.android.gms.maps.model.PolygonOptions; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; import java.util.HashMap; import java.util.List; import java.util.Map; +import kotlin.Result; +import kotlin.Unit; class PolygonsController { @@ -32,14 +33,14 @@ void setGoogleMap(GoogleMap googleMap) { this.googleMap = googleMap; } - void addPolygons(@NonNull List polygonsToAdd) { - for (Messages.PlatformPolygon polygonToAdd : polygonsToAdd) { + void addPolygons(@NonNull List polygonsToAdd) { + for (PlatformPolygon polygonToAdd : polygonsToAdd) { addPolygon(polygonToAdd); } } - void changePolygons(@NonNull List polygonsToChange) { - for (Messages.PlatformPolygon polygonToChange : polygonsToChange) { + void changePolygons(@NonNull List polygonsToChange) { + for (PlatformPolygon polygonToChange : polygonsToChange) { changePolygon(polygonToChange); } } @@ -59,7 +60,7 @@ boolean onPolygonTap(String googlePolygonId) { if (polygonId == null) { return false; } - flutterApi.onPolygonTap(polygonId, new NoOpVoidResult()); + flutterApi.onPolygonTap(polygonId, (Result result) -> Unit.INSTANCE); PolygonController polygonController = polygonIdToController.get(polygonId); if (polygonController != null) { return polygonController.consumeTapEvents(); @@ -67,7 +68,7 @@ boolean onPolygonTap(String googlePolygonId) { return false; } - private void addPolygon(@NonNull Messages.PlatformPolygon polygon) { + private void addPolygon(@NonNull PlatformPolygon polygon) { PolygonBuilder polygonBuilder = new PolygonBuilder(density); String polygonId = Convert.interpretPolygonOptions(polygon, polygonBuilder); PolygonOptions options = polygonBuilder.build(); @@ -82,14 +83,10 @@ private void addPolygon( googleMapsPolygonIdToDartPolygonId.put(polygon.getId(), polygonId); } - private void changePolygon(@NonNull Messages.PlatformPolygon polygon) { + private void changePolygon(@NonNull PlatformPolygon polygon) { PolygonController polygonController = polygonIdToController.get(polygon.getPolygonId()); if (polygonController != null) { Convert.interpretPolygonOptions(polygon, polygonController); } } - - private static String getPolygonId(Map polygon) { - return (String) polygon.get("polygonId"); - } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylineBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylineBuilder.java index fd6d8abc226e..135f42c44d84 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylineBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylineBuilder.java @@ -4,6 +4,7 @@ package io.flutter.plugins.googlemaps; +import androidx.annotation.NonNull; import com.google.android.gms.maps.model.Cap; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.PatternItem; @@ -11,7 +12,7 @@ import java.util.List; class PolylineBuilder implements PolylineOptionsSink { - private final PolylineOptions polylineOptions; + private final @NonNull PolylineOptions polylineOptions; private boolean consumeTapEvents; private final float density; @@ -60,8 +61,8 @@ public void setConsumeTapEvents(boolean consumeTapEvents) { } @Override - public void setGeodesic(boolean geodisc) { - polylineOptions.geodesic(geodisc); + public void setGeodesic(boolean geodesic) { + polylineOptions.geodesic(geodesic); } @Override diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylinesController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylinesController.java index 96bfa259b7b7..e89acaf7fe37 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylinesController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/PolylinesController.java @@ -9,10 +9,11 @@ import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; import java.util.HashMap; import java.util.List; import java.util.Map; +import kotlin.Result; +import kotlin.Unit; class PolylinesController { @@ -36,14 +37,14 @@ void setGoogleMap(GoogleMap googleMap) { this.googleMap = googleMap; } - void addPolylines(@NonNull List polylinesToAdd) { - for (Messages.PlatformPolyline polylineToAdd : polylinesToAdd) { + void addPolylines(@NonNull List polylinesToAdd) { + for (PlatformPolyline polylineToAdd : polylinesToAdd) { addPolyline(polylineToAdd); } } - void changePolylines(@NonNull List polylinesToChange) { - for (Messages.PlatformPolyline polylineToChange : polylinesToChange) { + void changePolylines(@NonNull List polylinesToChange) { + for (PlatformPolyline polylineToChange : polylinesToChange) { changePolyline(polylineToChange); } } @@ -63,7 +64,7 @@ boolean onPolylineTap(String googlePolylineId) { if (polylineId == null) { return false; } - flutterApi.onPolylineTap(polylineId, new NoOpVoidResult()); + flutterApi.onPolylineTap(polylineId, (Result result) -> Unit.INSTANCE); PolylineController polylineController = polylineIdToController.get(polylineId); if (polylineController != null) { return polylineController.consumeTapEvents(); @@ -71,7 +72,7 @@ boolean onPolylineTap(String googlePolylineId) { return false; } - private void addPolyline(@NonNull Messages.PlatformPolyline polyline) { + private void addPolyline(@NonNull PlatformPolyline polyline) { PolylineBuilder polylineBuilder = new PolylineBuilder(density); String polylineId = Convert.interpretPolylineOptions(polyline, polylineBuilder, assetManager, density); @@ -87,15 +88,11 @@ private void addPolyline( googleMapsPolylineIdToDartPolylineId.put(polyline.getId(), polylineId); } - private void changePolyline(@NonNull Messages.PlatformPolyline polyline) { + private void changePolyline(@NonNull PlatformPolyline polyline) { String polylineId = polyline.getPolylineId(); PolylineController polylineController = polylineIdToController.get(polylineId); if (polylineController != null) { Convert.interpretPolylineOptions(polyline, polylineController, assetManager, density); } } - - private static String getPolylineId(Map polyline) { - return (String) polyline.get("polylineId"); - } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlayBuilder.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlayBuilder.java index a7f52881babc..f0a8b80c833c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlayBuilder.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlayBuilder.java @@ -4,12 +4,13 @@ package io.flutter.plugins.googlemaps; +import androidx.annotation.NonNull; import com.google.android.gms.maps.model.TileOverlayOptions; import com.google.android.gms.maps.model.TileProvider; class TileOverlayBuilder implements TileOverlaySink { - private final TileOverlayOptions tileOverlayOptions; + private final @NonNull TileOverlayOptions tileOverlayOptions; TileOverlayBuilder() { this.tileOverlayOptions = new TileOverlayOptions(); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlaysController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlaysController.java index 09f794870910..0763899a06fc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlaysController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileOverlaysController.java @@ -9,7 +9,6 @@ import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.TileOverlay; import com.google.android.gms.maps.model.TileOverlayOptions; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,14 +28,14 @@ void setGoogleMap(GoogleMap googleMap) { this.googleMap = googleMap; } - void addTileOverlays(@NonNull List tileOverlaysToAdd) { - for (Messages.PlatformTileOverlay tileOverlayToAdd : tileOverlaysToAdd) { + void addTileOverlays(@NonNull List tileOverlaysToAdd) { + for (PlatformTileOverlay tileOverlayToAdd : tileOverlaysToAdd) { addTileOverlay(tileOverlayToAdd); } } - void changeTileOverlays(@NonNull List tileOverlaysToChange) { - for (Messages.PlatformTileOverlay tileOverlayToChange : tileOverlaysToChange) { + void changeTileOverlays(@NonNull List tileOverlaysToChange) { + for (PlatformTileOverlay tileOverlayToChange : tileOverlaysToChange) { changeTileOverlay(tileOverlayToChange); } } @@ -75,7 +74,7 @@ TileOverlay getTileOverlay(String tileOverlayId) { return tileOverlayController.getTileOverlay(); } - private void addTileOverlay(@NonNull Messages.PlatformTileOverlay platformTileOverlay) { + private void addTileOverlay(@NonNull PlatformTileOverlay platformTileOverlay) { TileOverlayBuilder tileOverlayOptionsBuilder = new TileOverlayBuilder(); String tileOverlayId = Convert.interpretTileOverlayOptions(platformTileOverlay, tileOverlayOptionsBuilder); @@ -88,7 +87,7 @@ private void addTileOverlay(@NonNull Messages.PlatformTileOverlay platformTileOv tileOverlayIdToController.put(tileOverlayId, tileOverlayController); } - private void changeTileOverlay(@NonNull Messages.PlatformTileOverlay platformTileOverlay) { + private void changeTileOverlay(@NonNull PlatformTileOverlay platformTileOverlay) { String tileOverlayId = platformTileOverlay.getTileOverlayId(); TileOverlayController tileOverlayController = tileOverlayIdToController.get(tileOverlayId); if (tileOverlayController != null) { @@ -103,9 +102,4 @@ private void removeTileOverlay(String tileOverlayId) { tileOverlayIdToController.remove(tileOverlayId); } } - - @SuppressWarnings("unchecked") - private static String getTileOverlayId(Map tileOverlay) { - return (String) tileOverlay.get("tileOverlayId"); - } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java index fea413dcb646..26c4e1f6f607 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/TileProviderController.java @@ -11,9 +11,8 @@ import androidx.annotation.Nullable; import com.google.android.gms.maps.model.Tile; import com.google.android.gms.maps.model.TileProvider; -import io.flutter.plugins.googlemaps.Messages.FlutterError; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; import java.util.concurrent.CountDownLatch; +import kotlin.Unit; class TileProviderController implements TileProvider { @@ -34,13 +33,13 @@ public Tile getTile(final int x, final int y, final int zoom) { return worker.getTile(); } - private final class Worker implements Messages.Result { + private final class Worker { private final CountDownLatch countDownLatch = new CountDownLatch(1); private final int x; private final int y; private final int zoom; - private @Nullable Messages.PlatformTile result; + private @Nullable PlatformTile tile; Worker(int x, int y, int zoom) { this.x = x; @@ -50,11 +49,37 @@ private final class Worker implements Messages.Result { @NonNull Tile getTile() { - final Messages.PlatformPoint location = - new Messages.PlatformPoint.Builder().setX((long) x).setY((long) y).build(); - handler.post(() -> flutterApi.getTileOverlayTile(tileOverlayId, location, (long) zoom, this)); + final PlatformPoint location = new PlatformPoint(x, y); + handler.post( + () -> + flutterApi.getTileOverlayTile( + tileOverlayId, + location, + zoom, + ResultCompat.asCompatCallback( + result -> { + tile = result.getOrNull(); + if (tile == null) { + final Throwable error = result.exceptionOrNull(); + if (error instanceof FlutterError flutterError) { + Log.e( + TAG, + "Can't get tile: errorCode = " + + flutterError.getCode() + + ", errorMessage = " + + flutterError.getMessage() + + ", date = " + + flutterError.getDetails()); + } else { + Log.e(TAG, "Can't get tile: " + error); + } + } + countDownLatch.countDown(); + return Unit.INSTANCE; + }))); try { - // `flutterApi.getTileOverlayTile` is async, so use a `countDownLatch` to make it synchronized. + // `flutterApi.getTileOverlayTile` is async, so use a `countDownLatch` to make it + // synchronized. countDownLatch.await(); } catch (InterruptedException e) { Log.e( @@ -64,43 +89,18 @@ Tile getTile() { return TileProvider.NO_TILE; } try { - if (result == null) { + if (tile == null) { Log.e( TAG, String.format( "Did not receive tile data for tile: x = %d, y= %d, zoom = %d", x, y, zoom)); return TileProvider.NO_TILE; } - return Convert.tileFromPigeon(result); + return Convert.tileFromPigeon(tile); } catch (Exception e) { Log.e(TAG, "Can't parse tile data", e); return TileProvider.NO_TILE; } } - - @Override - public void success(@NonNull Messages.PlatformTile result) { - this.result = result; - countDownLatch.countDown(); - } - - @Override - public void error(@NonNull Throwable error) { - if (error instanceof FlutterError) { - FlutterError flutterError = (FlutterError) error; - Log.e( - TAG, - "Can't get tile: errorCode = " - + flutterError.code - + ", errorMessage = " - + flutterError.getMessage() - + ", date = " - + flutterError.details); - } else { - Log.e(TAG, "Can't get tile: " + error); - } - result = null; - countDownLatch.countDown(); - } } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/kotlin/io/flutter/plugins/googlemaps/Messages.kt b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/kotlin/io/flutter/plugins/googlemaps/Messages.kt new file mode 100644 index 000000000000..3d5d0190d6a1 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/kotlin/io/flutter/plugins/googlemaps/Messages.kt @@ -0,0 +1,4698 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") + +package io.flutter.plugins.googlemaps + +import android.util.Log +import io.flutter.plugin.common.BasicMessageChannel +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.MessageCodec +import io.flutter.plugin.common.StandardMessageCodec +import java.io.ByteArrayOutputStream +import java.nio.ByteBuffer + +private object MessagesPigeonUtils { + + fun createConnectionError(channelName: String): FlutterError { + return FlutterError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + } + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } + } + + fun doubleEquals(a: Double, b: Double): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN()) + } + + fun floatEquals(a: Float, b: Float): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0f) 0.0f else a) == (if (b == 0.0f) 0.0f else b) || (a.isNaN() && b.isNaN()) + } + + fun doubleHash(d: Double): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (d == 0.0) 0.0 else d + val bits = java.lang.Double.doubleToLongBits(normalized) + return (bits xor (bits ushr 32)).toInt() + } + + fun floatHash(f: Float): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (f == 0.0f) 0.0f else f + return java.lang.Float.floatToIntBits(normalized) + } + + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a === b) { + return true + } + if (a == null || b == null) { + return false + } + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!doubleEquals(a[i], b[i])) return false + } + return true + } + if (a is FloatArray && b is FloatArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!floatEquals(a[i], b[i])) return false + } + return true + } + if (a is Array<*> && b is Array<*>) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!deepEquals(a[i], b[i])) return false + } + return true + } + if (a is List<*> && b is List<*>) { + if (a.size != b.size) return false + val iterA = a.iterator() + val iterB = b.iterator() + while (iterA.hasNext() && iterB.hasNext()) { + if (!deepEquals(iterA.next(), iterB.next())) return false + } + return true + } + if (a is Map<*, *> && b is Map<*, *>) { + if (a.size != b.size) return false + for (entry in a) { + val key = entry.key + var found = false + for (bEntry in b) { + if (deepEquals(key, bEntry.key)) { + if (deepEquals(entry.value, bEntry.value)) { + found = true + break + } else { + return false + } + } + } + if (!found) return false + } + return true + } + if (a is Double && b is Double) { + return doubleEquals(a, b) + } + if (a is Float && b is Float) { + return floatEquals(a, b) + } + return a == b + } + + fun deepHash(value: Any?): Int { + return when (value) { + null -> 0 + is ByteArray -> value.contentHashCode() + is IntArray -> value.contentHashCode() + is LongArray -> value.contentHashCode() + is DoubleArray -> { + var result = 1 + for (item in value) { + result = 31 * result + doubleHash(item) + } + result + } + is FloatArray -> { + var result = 1 + for (item in value) { + result = 31 * result + floatHash(item) + } + result + } + is Array<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is List<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is Map<*, *> -> { + var result = 0 + for (entry in value) { + result += ((deepHash(entry.key) * 31) xor deepHash(entry.value)) + } + result + } + is Double -> doubleHash(value) + is Float -> floatHash(value) + else -> value.hashCode() + } + } +} + +/** + * Error class for passing custom error details to Flutter via a thrown PlatformException. + * + * @property code The error code. + * @property message The error message. + * @property details The error details. Must be a datatype supported by the api codec. + */ +class FlutterError( + val code: String, + override val message: String? = null, + val details: Any? = null +) : RuntimeException() + +/** Pigeon equivalent of MapType */ +enum class PlatformMapType(val raw: Int) { + NONE(0), + NORMAL(1), + SATELLITE(2), + TERRAIN(3), + HYBRID(4); + + companion object { + fun ofRaw(raw: Int): PlatformMapType? { + return values().firstOrNull { it.raw == raw } + } + } +} + +enum class PlatformRendererType(val raw: Int) { + LEGACY(0), + LATEST(1); + + companion object { + fun ofRaw(raw: Int): PlatformRendererType? { + return values().firstOrNull { it.raw == raw } + } + } +} + +enum class PlatformMarkerCollisionBehavior(val raw: Int) { + REQUIRED_DISPLAY(0), + OPTIONAL_AND_HIDES_LOWER_PRIORITY(1), + REQUIRED_AND_HIDES_OPTIONAL(2); + + companion object { + fun ofRaw(raw: Int): PlatformMarkerCollisionBehavior? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** Join types for polyline joints. */ +enum class PlatformJointType(val raw: Int) { + MITERED(0), + BEVEL(1), + ROUND(2); + + companion object { + fun ofRaw(raw: Int): PlatformJointType? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** + * Enumeration of possible types of PlatformCap, corresponding to the subclasses of Cap in the + * Google Maps Android SDK. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/Cap. + */ +enum class PlatformCapType(val raw: Int) { + BUTT_CAP(0), + ROUND_CAP(1), + SQUARE_CAP(2), + CUSTOM_CAP(3); + + companion object { + fun ofRaw(raw: Int): PlatformCapType? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** Enumeration of possible types for PatternItem. */ +enum class PlatformPatternItemType(val raw: Int) { + DOT(0), + DASH(1), + GAP(2); + + companion object { + fun ofRaw(raw: Int): PlatformPatternItemType? { + return values().firstOrNull { it.raw == raw } + } + } +} + +enum class PlatformMarkerType(val raw: Int) { + MARKER(0), + ADVANCED_MARKER(1); + + companion object { + fun ofRaw(raw: Int): PlatformMarkerType? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** Pigeon equivalent of [MapBitmapScaling]. */ +enum class PlatformMapBitmapScaling(val raw: Int) { + AUTO(0), + NONE(1); + + companion object { + fun ofRaw(raw: Int): PlatformMapBitmapScaling? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** + * Pigeon representatation of a CameraPosition. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraPosition( + val bearing: Double, + val target: PlatformLatLng, + val tilt: Double, + val zoom: Double +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraPosition { + val bearing = pigeonVar_list[0] as Double + val target = pigeonVar_list[1] as PlatformLatLng + val tilt = pigeonVar_list[2] as Double + val zoom = pigeonVar_list[3] as Double + return PlatformCameraPosition(bearing, target, tilt, zoom) + } + } + + fun toList(): List { + return listOf( + bearing, + target, + tilt, + zoom, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraPosition + return MessagesPigeonUtils.deepEquals(this.bearing, other.bearing) && + MessagesPigeonUtils.deepEquals(this.target, other.target) && + MessagesPigeonUtils.deepEquals(this.tilt, other.tilt) && + MessagesPigeonUtils.deepEquals(this.zoom, other.zoom) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.bearing) + result = 31 * result + MessagesPigeonUtils.deepHash(this.target) + result = 31 * result + MessagesPigeonUtils.deepHash(this.tilt) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zoom) + return result + } +} + +/** + * Pigeon representation of a CameraUpdate. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdate( + /** + * This Object shall be any of the below classes prefixed with PlatformCameraUpdate. Each such + * class represents a different type of camera update, and each holds a different set of data, + * preventing the use of a single unified class. Pigeon does not support inheritance, which + * prevents a more strict type bound. See https://github.com/flutter/flutter/issues/117819. + */ + val cameraUpdate: Any +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdate { + val cameraUpdate = pigeonVar_list[0] as Any + return PlatformCameraUpdate(cameraUpdate) + } + } + + fun toList(): List { + return listOf( + cameraUpdate, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdate + return MessagesPigeonUtils.deepEquals(this.cameraUpdate, other.cameraUpdate) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.cameraUpdate) + return result + } +} + +/** + * Pigeon equivalent of NewCameraPosition + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateNewCameraPosition(val cameraPosition: PlatformCameraPosition) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateNewCameraPosition { + val cameraPosition = pigeonVar_list[0] as PlatformCameraPosition + return PlatformCameraUpdateNewCameraPosition(cameraPosition) + } + } + + fun toList(): List { + return listOf( + cameraPosition, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateNewCameraPosition + return MessagesPigeonUtils.deepEquals(this.cameraPosition, other.cameraPosition) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.cameraPosition) + return result + } +} + +/** + * Pigeon equivalent of NewLatLng + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateNewLatLng(val latLng: PlatformLatLng) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateNewLatLng { + val latLng = pigeonVar_list[0] as PlatformLatLng + return PlatformCameraUpdateNewLatLng(latLng) + } + } + + fun toList(): List { + return listOf( + latLng, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateNewLatLng + return MessagesPigeonUtils.deepEquals(this.latLng, other.latLng) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.latLng) + return result + } +} + +/** + * Pigeon equivalent of NewLatLngBounds + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateNewLatLngBounds( + val bounds: PlatformLatLngBounds, + val padding: Double +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateNewLatLngBounds { + val bounds = pigeonVar_list[0] as PlatformLatLngBounds + val padding = pigeonVar_list[1] as Double + return PlatformCameraUpdateNewLatLngBounds(bounds, padding) + } + } + + fun toList(): List { + return listOf( + bounds, + padding, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateNewLatLngBounds + return MessagesPigeonUtils.deepEquals(this.bounds, other.bounds) && + MessagesPigeonUtils.deepEquals(this.padding, other.padding) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.bounds) + result = 31 * result + MessagesPigeonUtils.deepHash(this.padding) + return result + } +} + +/** + * Pigeon equivalent of NewLatLngZoom + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateNewLatLngZoom(val latLng: PlatformLatLng, val zoom: Double) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateNewLatLngZoom { + val latLng = pigeonVar_list[0] as PlatformLatLng + val zoom = pigeonVar_list[1] as Double + return PlatformCameraUpdateNewLatLngZoom(latLng, zoom) + } + } + + fun toList(): List { + return listOf( + latLng, + zoom, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateNewLatLngZoom + return MessagesPigeonUtils.deepEquals(this.latLng, other.latLng) && + MessagesPigeonUtils.deepEquals(this.zoom, other.zoom) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.latLng) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zoom) + return result + } +} + +/** + * Pigeon equivalent of ScrollBy + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateScrollBy(val dx: Double, val dy: Double) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateScrollBy { + val dx = pigeonVar_list[0] as Double + val dy = pigeonVar_list[1] as Double + return PlatformCameraUpdateScrollBy(dx, dy) + } + } + + fun toList(): List { + return listOf( + dx, + dy, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateScrollBy + return MessagesPigeonUtils.deepEquals(this.dx, other.dx) && + MessagesPigeonUtils.deepEquals(this.dy, other.dy) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.dx) + result = 31 * result + MessagesPigeonUtils.deepHash(this.dy) + return result + } +} + +/** + * Pigeon equivalent of ZoomBy + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateZoomBy(val amount: Double, val focus: PlatformDoublePair? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateZoomBy { + val amount = pigeonVar_list[0] as Double + val focus = pigeonVar_list[1] as PlatformDoublePair? + return PlatformCameraUpdateZoomBy(amount, focus) + } + } + + fun toList(): List { + return listOf( + amount, + focus, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateZoomBy + return MessagesPigeonUtils.deepEquals(this.amount, other.amount) && + MessagesPigeonUtils.deepEquals(this.focus, other.focus) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.amount) + result = 31 * result + MessagesPigeonUtils.deepHash(this.focus) + return result + } +} + +/** + * Pigeon equivalent of ZoomIn/ZoomOut + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateZoom(val out: Boolean) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateZoom { + val out = pigeonVar_list[0] as Boolean + return PlatformCameraUpdateZoom(out) + } + } + + fun toList(): List { + return listOf( + out, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateZoom + return MessagesPigeonUtils.deepEquals(this.out, other.out) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.out) + return result + } +} + +/** + * Pigeon equivalent of ZoomTo + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraUpdateZoomTo(val zoom: Double) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraUpdateZoomTo { + val zoom = pigeonVar_list[0] as Double + return PlatformCameraUpdateZoomTo(zoom) + } + } + + fun toList(): List { + return listOf( + zoom, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraUpdateZoomTo + return MessagesPigeonUtils.deepEquals(this.zoom, other.zoom) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.zoom) + return result + } +} + +/** + * Pigeon equivalent of the Circle class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCircle( + val consumeTapEvents: Boolean, + val fillColor: PlatformColor, + val strokeColor: PlatformColor, + val visible: Boolean, + val strokeWidth: Long, + val zIndex: Double, + val center: PlatformLatLng, + val radius: Double, + val circleId: String +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCircle { + val consumeTapEvents = pigeonVar_list[0] as Boolean + val fillColor = pigeonVar_list[1] as PlatformColor + val strokeColor = pigeonVar_list[2] as PlatformColor + val visible = pigeonVar_list[3] as Boolean + val strokeWidth = pigeonVar_list[4] as Long + val zIndex = pigeonVar_list[5] as Double + val center = pigeonVar_list[6] as PlatformLatLng + val radius = pigeonVar_list[7] as Double + val circleId = pigeonVar_list[8] as String + return PlatformCircle( + consumeTapEvents, + fillColor, + strokeColor, + visible, + strokeWidth, + zIndex, + center, + radius, + circleId) + } + } + + fun toList(): List { + return listOf( + consumeTapEvents, + fillColor, + strokeColor, + visible, + strokeWidth, + zIndex, + center, + radius, + circleId, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCircle + return MessagesPigeonUtils.deepEquals(this.consumeTapEvents, other.consumeTapEvents) && + MessagesPigeonUtils.deepEquals(this.fillColor, other.fillColor) && + MessagesPigeonUtils.deepEquals(this.strokeColor, other.strokeColor) && + MessagesPigeonUtils.deepEquals(this.visible, other.visible) && + MessagesPigeonUtils.deepEquals(this.strokeWidth, other.strokeWidth) && + MessagesPigeonUtils.deepEquals(this.zIndex, other.zIndex) && + MessagesPigeonUtils.deepEquals(this.center, other.center) && + MessagesPigeonUtils.deepEquals(this.radius, other.radius) && + MessagesPigeonUtils.deepEquals(this.circleId, other.circleId) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.consumeTapEvents) + result = 31 * result + MessagesPigeonUtils.deepHash(this.fillColor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.strokeColor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.visible) + result = 31 * result + MessagesPigeonUtils.deepHash(this.strokeWidth) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zIndex) + result = 31 * result + MessagesPigeonUtils.deepHash(this.center) + result = 31 * result + MessagesPigeonUtils.deepHash(this.radius) + result = 31 * result + MessagesPigeonUtils.deepHash(this.circleId) + return result + } +} + +/** + * Pigeon equivalent of the Heatmap class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformHeatmap( + val heatmapId: String, + val data: List, + val gradient: PlatformHeatmapGradient? = null, + val opacity: Double, + val radius: Long, + val maxIntensity: Double? = null +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformHeatmap { + val heatmapId = pigeonVar_list[0] as String + val data = pigeonVar_list[1] as List + val gradient = pigeonVar_list[2] as PlatformHeatmapGradient? + val opacity = pigeonVar_list[3] as Double + val radius = pigeonVar_list[4] as Long + val maxIntensity = pigeonVar_list[5] as Double? + return PlatformHeatmap(heatmapId, data, gradient, opacity, radius, maxIntensity) + } + } + + fun toList(): List { + return listOf( + heatmapId, + data, + gradient, + opacity, + radius, + maxIntensity, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformHeatmap + return MessagesPigeonUtils.deepEquals(this.heatmapId, other.heatmapId) && + MessagesPigeonUtils.deepEquals(this.data, other.data) && + MessagesPigeonUtils.deepEquals(this.gradient, other.gradient) && + MessagesPigeonUtils.deepEquals(this.opacity, other.opacity) && + MessagesPigeonUtils.deepEquals(this.radius, other.radius) && + MessagesPigeonUtils.deepEquals(this.maxIntensity, other.maxIntensity) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.heatmapId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.data) + result = 31 * result + MessagesPigeonUtils.deepHash(this.gradient) + result = 31 * result + MessagesPigeonUtils.deepHash(this.opacity) + result = 31 * result + MessagesPigeonUtils.deepHash(this.radius) + result = 31 * result + MessagesPigeonUtils.deepHash(this.maxIntensity) + return result + } +} + +/** + * Pigeon equivalent of the HeatmapGradient class. + * + * The Java Gradient structure is slightly different from HeatmapGradient, so this matches the + * Android API so that conversion can be done on the Dart side where the structures are easier to + * work with. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformHeatmapGradient( + val colors: List, + val startPoints: List, + val colorMapSize: Long +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformHeatmapGradient { + val colors = pigeonVar_list[0] as List + val startPoints = pigeonVar_list[1] as List + val colorMapSize = pigeonVar_list[2] as Long + return PlatformHeatmapGradient(colors, startPoints, colorMapSize) + } + } + + fun toList(): List { + return listOf( + colors, + startPoints, + colorMapSize, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformHeatmapGradient + return MessagesPigeonUtils.deepEquals(this.colors, other.colors) && + MessagesPigeonUtils.deepEquals(this.startPoints, other.startPoints) && + MessagesPigeonUtils.deepEquals(this.colorMapSize, other.colorMapSize) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.colors) + result = 31 * result + MessagesPigeonUtils.deepHash(this.startPoints) + result = 31 * result + MessagesPigeonUtils.deepHash(this.colorMapSize) + return result + } +} + +/** + * Pigeon equivalent of the WeightedLatLng class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformWeightedLatLng(val point: PlatformLatLng, val weight: Double) { + companion object { + fun fromList(pigeonVar_list: List): PlatformWeightedLatLng { + val point = pigeonVar_list[0] as PlatformLatLng + val weight = pigeonVar_list[1] as Double + return PlatformWeightedLatLng(point, weight) + } + } + + fun toList(): List { + return listOf( + point, + weight, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformWeightedLatLng + return MessagesPigeonUtils.deepEquals(this.point, other.point) && + MessagesPigeonUtils.deepEquals(this.weight, other.weight) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.point) + result = 31 * result + MessagesPigeonUtils.deepHash(this.weight) + return result + } +} + +/** + * Pigeon equivalent of the ClusterManager class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformClusterManager(val identifier: String) { + companion object { + fun fromList(pigeonVar_list: List): PlatformClusterManager { + val identifier = pigeonVar_list[0] as String + return PlatformClusterManager(identifier) + } + } + + fun toList(): List { + return listOf( + identifier, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformClusterManager + return MessagesPigeonUtils.deepEquals(this.identifier, other.identifier) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.identifier) + return result + } +} + +/** + * Pair of double values, such as for an offset or size. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformDoublePair(val x: Double, val y: Double) { + companion object { + fun fromList(pigeonVar_list: List): PlatformDoublePair { + val x = pigeonVar_list[0] as Double + val y = pigeonVar_list[1] as Double + return PlatformDoublePair(x, y) + } + } + + fun toList(): List { + return listOf( + x, + y, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformDoublePair + return MessagesPigeonUtils.deepEquals(this.x, other.x) && + MessagesPigeonUtils.deepEquals(this.y, other.y) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.x) + result = 31 * result + MessagesPigeonUtils.deepHash(this.y) + return result + } +} + +/** + * Pigeon equivalent of the Color class. + * + * See https://developer.android.com/reference/android/graphics/Color.html. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformColor(val argbValue: Long) { + companion object { + fun fromList(pigeonVar_list: List): PlatformColor { + val argbValue = pigeonVar_list[0] as Long + return PlatformColor(argbValue) + } + } + + fun toList(): List { + return listOf( + argbValue, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformColor + return MessagesPigeonUtils.deepEquals(this.argbValue, other.argbValue) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.argbValue) + return result + } +} + +/** + * Pigeon equivalent of the InfoWindow class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformInfoWindow( + val title: String? = null, + val snippet: String? = null, + val anchor: PlatformDoublePair +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformInfoWindow { + val title = pigeonVar_list[0] as String? + val snippet = pigeonVar_list[1] as String? + val anchor = pigeonVar_list[2] as PlatformDoublePair + return PlatformInfoWindow(title, snippet, anchor) + } + } + + fun toList(): List { + return listOf( + title, + snippet, + anchor, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformInfoWindow + return MessagesPigeonUtils.deepEquals(this.title, other.title) && + MessagesPigeonUtils.deepEquals(this.snippet, other.snippet) && + MessagesPigeonUtils.deepEquals(this.anchor, other.anchor) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.title) + result = 31 * result + MessagesPigeonUtils.deepHash(this.snippet) + result = 31 * result + MessagesPigeonUtils.deepHash(this.anchor) + return result + } +} + +/** + * Pigeon equivalent of the Marker class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformMarker( + val alpha: Double, + val anchor: PlatformDoublePair, + val consumeTapEvents: Boolean, + val draggable: Boolean, + val flat: Boolean, + val icon: PlatformBitmap, + val infoWindow: PlatformInfoWindow, + val position: PlatformLatLng, + val rotation: Double, + val visible: Boolean, + val zIndex: Double, + val markerId: String, + val clusterManagerId: String? = null, + val collisionBehavior: PlatformMarkerCollisionBehavior +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformMarker { + val alpha = pigeonVar_list[0] as Double + val anchor = pigeonVar_list[1] as PlatformDoublePair + val consumeTapEvents = pigeonVar_list[2] as Boolean + val draggable = pigeonVar_list[3] as Boolean + val flat = pigeonVar_list[4] as Boolean + val icon = pigeonVar_list[5] as PlatformBitmap + val infoWindow = pigeonVar_list[6] as PlatformInfoWindow + val position = pigeonVar_list[7] as PlatformLatLng + val rotation = pigeonVar_list[8] as Double + val visible = pigeonVar_list[9] as Boolean + val zIndex = pigeonVar_list[10] as Double + val markerId = pigeonVar_list[11] as String + val clusterManagerId = pigeonVar_list[12] as String? + val collisionBehavior = pigeonVar_list[13] as PlatformMarkerCollisionBehavior + return PlatformMarker( + alpha, + anchor, + consumeTapEvents, + draggable, + flat, + icon, + infoWindow, + position, + rotation, + visible, + zIndex, + markerId, + clusterManagerId, + collisionBehavior) + } + } + + fun toList(): List { + return listOf( + alpha, + anchor, + consumeTapEvents, + draggable, + flat, + icon, + infoWindow, + position, + rotation, + visible, + zIndex, + markerId, + clusterManagerId, + collisionBehavior, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformMarker + return MessagesPigeonUtils.deepEquals(this.alpha, other.alpha) && + MessagesPigeonUtils.deepEquals(this.anchor, other.anchor) && + MessagesPigeonUtils.deepEquals(this.consumeTapEvents, other.consumeTapEvents) && + MessagesPigeonUtils.deepEquals(this.draggable, other.draggable) && + MessagesPigeonUtils.deepEquals(this.flat, other.flat) && + MessagesPigeonUtils.deepEquals(this.icon, other.icon) && + MessagesPigeonUtils.deepEquals(this.infoWindow, other.infoWindow) && + MessagesPigeonUtils.deepEquals(this.position, other.position) && + MessagesPigeonUtils.deepEquals(this.rotation, other.rotation) && + MessagesPigeonUtils.deepEquals(this.visible, other.visible) && + MessagesPigeonUtils.deepEquals(this.zIndex, other.zIndex) && + MessagesPigeonUtils.deepEquals(this.markerId, other.markerId) && + MessagesPigeonUtils.deepEquals(this.clusterManagerId, other.clusterManagerId) && + MessagesPigeonUtils.deepEquals(this.collisionBehavior, other.collisionBehavior) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.alpha) + result = 31 * result + MessagesPigeonUtils.deepHash(this.anchor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.consumeTapEvents) + result = 31 * result + MessagesPigeonUtils.deepHash(this.draggable) + result = 31 * result + MessagesPigeonUtils.deepHash(this.flat) + result = 31 * result + MessagesPigeonUtils.deepHash(this.icon) + result = 31 * result + MessagesPigeonUtils.deepHash(this.infoWindow) + result = 31 * result + MessagesPigeonUtils.deepHash(this.position) + result = 31 * result + MessagesPigeonUtils.deepHash(this.rotation) + result = 31 * result + MessagesPigeonUtils.deepHash(this.visible) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zIndex) + result = 31 * result + MessagesPigeonUtils.deepHash(this.markerId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.clusterManagerId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.collisionBehavior) + return result + } +} + +/** + * Pigeon equivalent of the Polygon class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformPolygon( + val polygonId: String, + val consumesTapEvents: Boolean, + val fillColor: PlatformColor, + val geodesic: Boolean, + val points: List, + val holes: List>, + val visible: Boolean, + val strokeColor: PlatformColor, + val strokeWidth: Long, + val zIndex: Long +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformPolygon { + val polygonId = pigeonVar_list[0] as String + val consumesTapEvents = pigeonVar_list[1] as Boolean + val fillColor = pigeonVar_list[2] as PlatformColor + val geodesic = pigeonVar_list[3] as Boolean + val points = pigeonVar_list[4] as List + val holes = pigeonVar_list[5] as List> + val visible = pigeonVar_list[6] as Boolean + val strokeColor = pigeonVar_list[7] as PlatformColor + val strokeWidth = pigeonVar_list[8] as Long + val zIndex = pigeonVar_list[9] as Long + return PlatformPolygon( + polygonId, + consumesTapEvents, + fillColor, + geodesic, + points, + holes, + visible, + strokeColor, + strokeWidth, + zIndex) + } + } + + fun toList(): List { + return listOf( + polygonId, + consumesTapEvents, + fillColor, + geodesic, + points, + holes, + visible, + strokeColor, + strokeWidth, + zIndex, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformPolygon + return MessagesPigeonUtils.deepEquals(this.polygonId, other.polygonId) && + MessagesPigeonUtils.deepEquals(this.consumesTapEvents, other.consumesTapEvents) && + MessagesPigeonUtils.deepEquals(this.fillColor, other.fillColor) && + MessagesPigeonUtils.deepEquals(this.geodesic, other.geodesic) && + MessagesPigeonUtils.deepEquals(this.points, other.points) && + MessagesPigeonUtils.deepEquals(this.holes, other.holes) && + MessagesPigeonUtils.deepEquals(this.visible, other.visible) && + MessagesPigeonUtils.deepEquals(this.strokeColor, other.strokeColor) && + MessagesPigeonUtils.deepEquals(this.strokeWidth, other.strokeWidth) && + MessagesPigeonUtils.deepEquals(this.zIndex, other.zIndex) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.polygonId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.consumesTapEvents) + result = 31 * result + MessagesPigeonUtils.deepHash(this.fillColor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.geodesic) + result = 31 * result + MessagesPigeonUtils.deepHash(this.points) + result = 31 * result + MessagesPigeonUtils.deepHash(this.holes) + result = 31 * result + MessagesPigeonUtils.deepHash(this.visible) + result = 31 * result + MessagesPigeonUtils.deepHash(this.strokeColor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.strokeWidth) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zIndex) + return result + } +} + +/** + * Pigeon equivalent of the Polyline class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformPolyline( + val polylineId: String, + val consumesTapEvents: Boolean, + val color: PlatformColor, + val geodesic: Boolean, + /** The joint type. */ + val jointType: PlatformJointType, + /** The pattern data, as a list of pattern items. */ + val patterns: List, + val points: List, + /** + * The cap at the start and end vertex of a polyline. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/Cap. + */ + val startCap: PlatformCap, + val endCap: PlatformCap, + val visible: Boolean, + val width: Long, + val zIndex: Long +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformPolyline { + val polylineId = pigeonVar_list[0] as String + val consumesTapEvents = pigeonVar_list[1] as Boolean + val color = pigeonVar_list[2] as PlatformColor + val geodesic = pigeonVar_list[3] as Boolean + val jointType = pigeonVar_list[4] as PlatformJointType + val patterns = pigeonVar_list[5] as List + val points = pigeonVar_list[6] as List + val startCap = pigeonVar_list[7] as PlatformCap + val endCap = pigeonVar_list[8] as PlatformCap + val visible = pigeonVar_list[9] as Boolean + val width = pigeonVar_list[10] as Long + val zIndex = pigeonVar_list[11] as Long + return PlatformPolyline( + polylineId, + consumesTapEvents, + color, + geodesic, + jointType, + patterns, + points, + startCap, + endCap, + visible, + width, + zIndex) + } + } + + fun toList(): List { + return listOf( + polylineId, + consumesTapEvents, + color, + geodesic, + jointType, + patterns, + points, + startCap, + endCap, + visible, + width, + zIndex, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformPolyline + return MessagesPigeonUtils.deepEquals(this.polylineId, other.polylineId) && + MessagesPigeonUtils.deepEquals(this.consumesTapEvents, other.consumesTapEvents) && + MessagesPigeonUtils.deepEquals(this.color, other.color) && + MessagesPigeonUtils.deepEquals(this.geodesic, other.geodesic) && + MessagesPigeonUtils.deepEquals(this.jointType, other.jointType) && + MessagesPigeonUtils.deepEquals(this.patterns, other.patterns) && + MessagesPigeonUtils.deepEquals(this.points, other.points) && + MessagesPigeonUtils.deepEquals(this.startCap, other.startCap) && + MessagesPigeonUtils.deepEquals(this.endCap, other.endCap) && + MessagesPigeonUtils.deepEquals(this.visible, other.visible) && + MessagesPigeonUtils.deepEquals(this.width, other.width) && + MessagesPigeonUtils.deepEquals(this.zIndex, other.zIndex) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.polylineId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.consumesTapEvents) + result = 31 * result + MessagesPigeonUtils.deepHash(this.color) + result = 31 * result + MessagesPigeonUtils.deepHash(this.geodesic) + result = 31 * result + MessagesPigeonUtils.deepHash(this.jointType) + result = 31 * result + MessagesPigeonUtils.deepHash(this.patterns) + result = 31 * result + MessagesPigeonUtils.deepHash(this.points) + result = 31 * result + MessagesPigeonUtils.deepHash(this.startCap) + result = 31 * result + MessagesPigeonUtils.deepHash(this.endCap) + result = 31 * result + MessagesPigeonUtils.deepHash(this.visible) + result = 31 * result + MessagesPigeonUtils.deepHash(this.width) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zIndex) + return result + } +} + +/** + * Pigeon equivalent of Cap from the platform interface. + * https://github.com/flutter/packages/blob/main/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/cap.dart + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCap( + val type: PlatformCapType, + val bitmapDescriptor: PlatformBitmap? = null, + val refWidth: Double? = null +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCap { + val type = pigeonVar_list[0] as PlatformCapType + val bitmapDescriptor = pigeonVar_list[1] as PlatformBitmap? + val refWidth = pigeonVar_list[2] as Double? + return PlatformCap(type, bitmapDescriptor, refWidth) + } + } + + fun toList(): List { + return listOf( + type, + bitmapDescriptor, + refWidth, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCap + return MessagesPigeonUtils.deepEquals(this.type, other.type) && + MessagesPigeonUtils.deepEquals(this.bitmapDescriptor, other.bitmapDescriptor) && + MessagesPigeonUtils.deepEquals(this.refWidth, other.refWidth) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.type) + result = 31 * result + MessagesPigeonUtils.deepHash(this.bitmapDescriptor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.refWidth) + return result + } +} + +/** + * Pigeon equivalent of the PatternItem class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformPatternItem(val type: PlatformPatternItemType, val length: Double? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformPatternItem { + val type = pigeonVar_list[0] as PlatformPatternItemType + val length = pigeonVar_list[1] as Double? + return PlatformPatternItem(type, length) + } + } + + fun toList(): List { + return listOf( + type, + length, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformPatternItem + return MessagesPigeonUtils.deepEquals(this.type, other.type) && + MessagesPigeonUtils.deepEquals(this.length, other.length) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.type) + result = 31 * result + MessagesPigeonUtils.deepHash(this.length) + return result + } +} + +/** + * Pigeon equivalent of the Tile class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformTile(val width: Long, val height: Long, val data: ByteArray? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformTile { + val width = pigeonVar_list[0] as Long + val height = pigeonVar_list[1] as Long + val data = pigeonVar_list[2] as ByteArray? + return PlatformTile(width, height, data) + } + } + + fun toList(): List { + return listOf( + width, + height, + data, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformTile + return MessagesPigeonUtils.deepEquals(this.width, other.width) && + MessagesPigeonUtils.deepEquals(this.height, other.height) && + MessagesPigeonUtils.deepEquals(this.data, other.data) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.width) + result = 31 * result + MessagesPigeonUtils.deepHash(this.height) + result = 31 * result + MessagesPigeonUtils.deepHash(this.data) + return result + } +} + +/** + * Pigeon equivalent of the TileOverlay class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformTileOverlay( + val tileOverlayId: String, + val fadeIn: Boolean, + val transparency: Double, + val zIndex: Long, + val visible: Boolean, + val tileSize: Long +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformTileOverlay { + val tileOverlayId = pigeonVar_list[0] as String + val fadeIn = pigeonVar_list[1] as Boolean + val transparency = pigeonVar_list[2] as Double + val zIndex = pigeonVar_list[3] as Long + val visible = pigeonVar_list[4] as Boolean + val tileSize = pigeonVar_list[5] as Long + return PlatformTileOverlay(tileOverlayId, fadeIn, transparency, zIndex, visible, tileSize) + } + } + + fun toList(): List { + return listOf( + tileOverlayId, + fadeIn, + transparency, + zIndex, + visible, + tileSize, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformTileOverlay + return MessagesPigeonUtils.deepEquals(this.tileOverlayId, other.tileOverlayId) && + MessagesPigeonUtils.deepEquals(this.fadeIn, other.fadeIn) && + MessagesPigeonUtils.deepEquals(this.transparency, other.transparency) && + MessagesPigeonUtils.deepEquals(this.zIndex, other.zIndex) && + MessagesPigeonUtils.deepEquals(this.visible, other.visible) && + MessagesPigeonUtils.deepEquals(this.tileSize, other.tileSize) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.tileOverlayId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.fadeIn) + result = 31 * result + MessagesPigeonUtils.deepHash(this.transparency) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zIndex) + result = 31 * result + MessagesPigeonUtils.deepHash(this.visible) + result = 31 * result + MessagesPigeonUtils.deepHash(this.tileSize) + return result + } +} + +/** + * Pigeon equivalent of Flutter's EdgeInsets. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformEdgeInsets( + val top: Double, + val bottom: Double, + val left: Double, + val right: Double +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformEdgeInsets { + val top = pigeonVar_list[0] as Double + val bottom = pigeonVar_list[1] as Double + val left = pigeonVar_list[2] as Double + val right = pigeonVar_list[3] as Double + return PlatformEdgeInsets(top, bottom, left, right) + } + } + + fun toList(): List { + return listOf( + top, + bottom, + left, + right, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformEdgeInsets + return MessagesPigeonUtils.deepEquals(this.top, other.top) && + MessagesPigeonUtils.deepEquals(this.bottom, other.bottom) && + MessagesPigeonUtils.deepEquals(this.left, other.left) && + MessagesPigeonUtils.deepEquals(this.right, other.right) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.top) + result = 31 * result + MessagesPigeonUtils.deepHash(this.bottom) + result = 31 * result + MessagesPigeonUtils.deepHash(this.left) + result = 31 * result + MessagesPigeonUtils.deepHash(this.right) + return result + } +} + +/** + * Pigeon equivalent of LatLng. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformLatLng(val latitude: Double, val longitude: Double) { + companion object { + fun fromList(pigeonVar_list: List): PlatformLatLng { + val latitude = pigeonVar_list[0] as Double + val longitude = pigeonVar_list[1] as Double + return PlatformLatLng(latitude, longitude) + } + } + + fun toList(): List { + return listOf( + latitude, + longitude, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformLatLng + return MessagesPigeonUtils.deepEquals(this.latitude, other.latitude) && + MessagesPigeonUtils.deepEquals(this.longitude, other.longitude) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.latitude) + result = 31 * result + MessagesPigeonUtils.deepHash(this.longitude) + return result + } +} + +/** + * Pigeon equivalent of LatLngBounds. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformLatLngBounds(val northeast: PlatformLatLng, val southwest: PlatformLatLng) { + companion object { + fun fromList(pigeonVar_list: List): PlatformLatLngBounds { + val northeast = pigeonVar_list[0] as PlatformLatLng + val southwest = pigeonVar_list[1] as PlatformLatLng + return PlatformLatLngBounds(northeast, southwest) + } + } + + fun toList(): List { + return listOf( + northeast, + southwest, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformLatLngBounds + return MessagesPigeonUtils.deepEquals(this.northeast, other.northeast) && + MessagesPigeonUtils.deepEquals(this.southwest, other.southwest) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.northeast) + result = 31 * result + MessagesPigeonUtils.deepHash(this.southwest) + return result + } +} + +/** + * Pigeon equivalent of Cluster. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCluster( + val clusterManagerId: String, + val position: PlatformLatLng, + val bounds: PlatformLatLngBounds, + val markerIds: List +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCluster { + val clusterManagerId = pigeonVar_list[0] as String + val position = pigeonVar_list[1] as PlatformLatLng + val bounds = pigeonVar_list[2] as PlatformLatLngBounds + val markerIds = pigeonVar_list[3] as List + return PlatformCluster(clusterManagerId, position, bounds, markerIds) + } + } + + fun toList(): List { + return listOf( + clusterManagerId, + position, + bounds, + markerIds, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCluster + return MessagesPigeonUtils.deepEquals(this.clusterManagerId, other.clusterManagerId) && + MessagesPigeonUtils.deepEquals(this.position, other.position) && + MessagesPigeonUtils.deepEquals(this.bounds, other.bounds) && + MessagesPigeonUtils.deepEquals(this.markerIds, other.markerIds) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.clusterManagerId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.position) + result = 31 * result + MessagesPigeonUtils.deepHash(this.bounds) + result = 31 * result + MessagesPigeonUtils.deepHash(this.markerIds) + return result + } +} + +/** + * Pigeon equivalent of the GroundOverlay class. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformGroundOverlay( + val groundOverlayId: String, + val image: PlatformBitmap, + val position: PlatformLatLng? = null, + val bounds: PlatformLatLngBounds? = null, + val width: Double? = null, + val height: Double? = null, + val anchor: PlatformDoublePair? = null, + val transparency: Double, + val bearing: Double, + val zIndex: Long, + val visible: Boolean, + val clickable: Boolean +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformGroundOverlay { + val groundOverlayId = pigeonVar_list[0] as String + val image = pigeonVar_list[1] as PlatformBitmap + val position = pigeonVar_list[2] as PlatformLatLng? + val bounds = pigeonVar_list[3] as PlatformLatLngBounds? + val width = pigeonVar_list[4] as Double? + val height = pigeonVar_list[5] as Double? + val anchor = pigeonVar_list[6] as PlatformDoublePair? + val transparency = pigeonVar_list[7] as Double + val bearing = pigeonVar_list[8] as Double + val zIndex = pigeonVar_list[9] as Long + val visible = pigeonVar_list[10] as Boolean + val clickable = pigeonVar_list[11] as Boolean + return PlatformGroundOverlay( + groundOverlayId, + image, + position, + bounds, + width, + height, + anchor, + transparency, + bearing, + zIndex, + visible, + clickable) + } + } + + fun toList(): List { + return listOf( + groundOverlayId, + image, + position, + bounds, + width, + height, + anchor, + transparency, + bearing, + zIndex, + visible, + clickable, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformGroundOverlay + return MessagesPigeonUtils.deepEquals(this.groundOverlayId, other.groundOverlayId) && + MessagesPigeonUtils.deepEquals(this.image, other.image) && + MessagesPigeonUtils.deepEquals(this.position, other.position) && + MessagesPigeonUtils.deepEquals(this.bounds, other.bounds) && + MessagesPigeonUtils.deepEquals(this.width, other.width) && + MessagesPigeonUtils.deepEquals(this.height, other.height) && + MessagesPigeonUtils.deepEquals(this.anchor, other.anchor) && + MessagesPigeonUtils.deepEquals(this.transparency, other.transparency) && + MessagesPigeonUtils.deepEquals(this.bearing, other.bearing) && + MessagesPigeonUtils.deepEquals(this.zIndex, other.zIndex) && + MessagesPigeonUtils.deepEquals(this.visible, other.visible) && + MessagesPigeonUtils.deepEquals(this.clickable, other.clickable) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.groundOverlayId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.image) + result = 31 * result + MessagesPigeonUtils.deepHash(this.position) + result = 31 * result + MessagesPigeonUtils.deepHash(this.bounds) + result = 31 * result + MessagesPigeonUtils.deepHash(this.width) + result = 31 * result + MessagesPigeonUtils.deepHash(this.height) + result = 31 * result + MessagesPigeonUtils.deepHash(this.anchor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.transparency) + result = 31 * result + MessagesPigeonUtils.deepHash(this.bearing) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zIndex) + result = 31 * result + MessagesPigeonUtils.deepHash(this.visible) + result = 31 * result + MessagesPigeonUtils.deepHash(this.clickable) + return result + } +} + +/** + * Pigeon equivalent of CameraTargetBounds. + * + * As with the Dart version, it exists to distinguish between not setting a a target, and having an + * explicitly unbounded target (null [bounds]). + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformCameraTargetBounds(val bounds: PlatformLatLngBounds? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformCameraTargetBounds { + val bounds = pigeonVar_list[0] as PlatformLatLngBounds? + return PlatformCameraTargetBounds(bounds) + } + } + + fun toList(): List { + return listOf( + bounds, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformCameraTargetBounds + return MessagesPigeonUtils.deepEquals(this.bounds, other.bounds) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.bounds) + return result + } +} + +/** + * Information passed to the platform view creation. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformMapViewCreationParams( + val initialCameraPosition: PlatformCameraPosition, + val mapConfiguration: PlatformMapConfiguration, + val initialCircles: List, + val initialMarkers: List, + val initialPolygons: List, + val initialPolylines: List, + val initialHeatmaps: List, + val initialTileOverlays: List, + val initialClusterManagers: List, + val initialGroundOverlays: List +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformMapViewCreationParams { + val initialCameraPosition = pigeonVar_list[0] as PlatformCameraPosition + val mapConfiguration = pigeonVar_list[1] as PlatformMapConfiguration + val initialCircles = pigeonVar_list[2] as List + val initialMarkers = pigeonVar_list[3] as List + val initialPolygons = pigeonVar_list[4] as List + val initialPolylines = pigeonVar_list[5] as List + val initialHeatmaps = pigeonVar_list[6] as List + val initialTileOverlays = pigeonVar_list[7] as List + val initialClusterManagers = pigeonVar_list[8] as List + val initialGroundOverlays = pigeonVar_list[9] as List + return PlatformMapViewCreationParams( + initialCameraPosition, + mapConfiguration, + initialCircles, + initialMarkers, + initialPolygons, + initialPolylines, + initialHeatmaps, + initialTileOverlays, + initialClusterManagers, + initialGroundOverlays) + } + } + + fun toList(): List { + return listOf( + initialCameraPosition, + mapConfiguration, + initialCircles, + initialMarkers, + initialPolygons, + initialPolylines, + initialHeatmaps, + initialTileOverlays, + initialClusterManagers, + initialGroundOverlays, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformMapViewCreationParams + return MessagesPigeonUtils.deepEquals( + this.initialCameraPosition, other.initialCameraPosition) && + MessagesPigeonUtils.deepEquals(this.mapConfiguration, other.mapConfiguration) && + MessagesPigeonUtils.deepEquals(this.initialCircles, other.initialCircles) && + MessagesPigeonUtils.deepEquals(this.initialMarkers, other.initialMarkers) && + MessagesPigeonUtils.deepEquals(this.initialPolygons, other.initialPolygons) && + MessagesPigeonUtils.deepEquals(this.initialPolylines, other.initialPolylines) && + MessagesPigeonUtils.deepEquals(this.initialHeatmaps, other.initialHeatmaps) && + MessagesPigeonUtils.deepEquals(this.initialTileOverlays, other.initialTileOverlays) && + MessagesPigeonUtils.deepEquals(this.initialClusterManagers, other.initialClusterManagers) && + MessagesPigeonUtils.deepEquals(this.initialGroundOverlays, other.initialGroundOverlays) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialCameraPosition) + result = 31 * result + MessagesPigeonUtils.deepHash(this.mapConfiguration) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialCircles) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialMarkers) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialPolygons) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialPolylines) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialHeatmaps) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialTileOverlays) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialClusterManagers) + result = 31 * result + MessagesPigeonUtils.deepHash(this.initialGroundOverlays) + return result + } +} + +/** + * Pigeon equivalent of MapConfiguration. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformMapConfiguration( + val compassEnabled: Boolean? = null, + val cameraTargetBounds: PlatformCameraTargetBounds? = null, + val mapType: PlatformMapType? = null, + val minMaxZoomPreference: PlatformZoomRange? = null, + val mapToolbarEnabled: Boolean? = null, + val rotateGesturesEnabled: Boolean? = null, + val scrollGesturesEnabled: Boolean? = null, + val tiltGesturesEnabled: Boolean? = null, + val trackCameraPosition: Boolean? = null, + val zoomControlsEnabled: Boolean? = null, + val zoomGesturesEnabled: Boolean? = null, + val myLocationEnabled: Boolean? = null, + val myLocationButtonEnabled: Boolean? = null, + val padding: PlatformEdgeInsets? = null, + val indoorViewEnabled: Boolean? = null, + val trafficEnabled: Boolean? = null, + val buildingsEnabled: Boolean? = null, + val liteModeEnabled: Boolean? = null, + val markerType: PlatformMarkerType, + val mapId: String? = null, + val style: String? = null +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformMapConfiguration { + val compassEnabled = pigeonVar_list[0] as Boolean? + val cameraTargetBounds = pigeonVar_list[1] as PlatformCameraTargetBounds? + val mapType = pigeonVar_list[2] as PlatformMapType? + val minMaxZoomPreference = pigeonVar_list[3] as PlatformZoomRange? + val mapToolbarEnabled = pigeonVar_list[4] as Boolean? + val rotateGesturesEnabled = pigeonVar_list[5] as Boolean? + val scrollGesturesEnabled = pigeonVar_list[6] as Boolean? + val tiltGesturesEnabled = pigeonVar_list[7] as Boolean? + val trackCameraPosition = pigeonVar_list[8] as Boolean? + val zoomControlsEnabled = pigeonVar_list[9] as Boolean? + val zoomGesturesEnabled = pigeonVar_list[10] as Boolean? + val myLocationEnabled = pigeonVar_list[11] as Boolean? + val myLocationButtonEnabled = pigeonVar_list[12] as Boolean? + val padding = pigeonVar_list[13] as PlatformEdgeInsets? + val indoorViewEnabled = pigeonVar_list[14] as Boolean? + val trafficEnabled = pigeonVar_list[15] as Boolean? + val buildingsEnabled = pigeonVar_list[16] as Boolean? + val liteModeEnabled = pigeonVar_list[17] as Boolean? + val markerType = pigeonVar_list[18] as PlatformMarkerType + val mapId = pigeonVar_list[19] as String? + val style = pigeonVar_list[20] as String? + return PlatformMapConfiguration( + compassEnabled, + cameraTargetBounds, + mapType, + minMaxZoomPreference, + mapToolbarEnabled, + rotateGesturesEnabled, + scrollGesturesEnabled, + tiltGesturesEnabled, + trackCameraPosition, + zoomControlsEnabled, + zoomGesturesEnabled, + myLocationEnabled, + myLocationButtonEnabled, + padding, + indoorViewEnabled, + trafficEnabled, + buildingsEnabled, + liteModeEnabled, + markerType, + mapId, + style) + } + } + + fun toList(): List { + return listOf( + compassEnabled, + cameraTargetBounds, + mapType, + minMaxZoomPreference, + mapToolbarEnabled, + rotateGesturesEnabled, + scrollGesturesEnabled, + tiltGesturesEnabled, + trackCameraPosition, + zoomControlsEnabled, + zoomGesturesEnabled, + myLocationEnabled, + myLocationButtonEnabled, + padding, + indoorViewEnabled, + trafficEnabled, + buildingsEnabled, + liteModeEnabled, + markerType, + mapId, + style, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformMapConfiguration + return MessagesPigeonUtils.deepEquals(this.compassEnabled, other.compassEnabled) && + MessagesPigeonUtils.deepEquals(this.cameraTargetBounds, other.cameraTargetBounds) && + MessagesPigeonUtils.deepEquals(this.mapType, other.mapType) && + MessagesPigeonUtils.deepEquals(this.minMaxZoomPreference, other.minMaxZoomPreference) && + MessagesPigeonUtils.deepEquals(this.mapToolbarEnabled, other.mapToolbarEnabled) && + MessagesPigeonUtils.deepEquals(this.rotateGesturesEnabled, other.rotateGesturesEnabled) && + MessagesPigeonUtils.deepEquals(this.scrollGesturesEnabled, other.scrollGesturesEnabled) && + MessagesPigeonUtils.deepEquals(this.tiltGesturesEnabled, other.tiltGesturesEnabled) && + MessagesPigeonUtils.deepEquals(this.trackCameraPosition, other.trackCameraPosition) && + MessagesPigeonUtils.deepEquals(this.zoomControlsEnabled, other.zoomControlsEnabled) && + MessagesPigeonUtils.deepEquals(this.zoomGesturesEnabled, other.zoomGesturesEnabled) && + MessagesPigeonUtils.deepEquals(this.myLocationEnabled, other.myLocationEnabled) && + MessagesPigeonUtils.deepEquals( + this.myLocationButtonEnabled, other.myLocationButtonEnabled) && + MessagesPigeonUtils.deepEquals(this.padding, other.padding) && + MessagesPigeonUtils.deepEquals(this.indoorViewEnabled, other.indoorViewEnabled) && + MessagesPigeonUtils.deepEquals(this.trafficEnabled, other.trafficEnabled) && + MessagesPigeonUtils.deepEquals(this.buildingsEnabled, other.buildingsEnabled) && + MessagesPigeonUtils.deepEquals(this.liteModeEnabled, other.liteModeEnabled) && + MessagesPigeonUtils.deepEquals(this.markerType, other.markerType) && + MessagesPigeonUtils.deepEquals(this.mapId, other.mapId) && + MessagesPigeonUtils.deepEquals(this.style, other.style) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.compassEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.cameraTargetBounds) + result = 31 * result + MessagesPigeonUtils.deepHash(this.mapType) + result = 31 * result + MessagesPigeonUtils.deepHash(this.minMaxZoomPreference) + result = 31 * result + MessagesPigeonUtils.deepHash(this.mapToolbarEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.rotateGesturesEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.scrollGesturesEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.tiltGesturesEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.trackCameraPosition) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zoomControlsEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zoomGesturesEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.myLocationEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.myLocationButtonEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.padding) + result = 31 * result + MessagesPigeonUtils.deepHash(this.indoorViewEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.trafficEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.buildingsEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.liteModeEnabled) + result = 31 * result + MessagesPigeonUtils.deepHash(this.markerType) + result = 31 * result + MessagesPigeonUtils.deepHash(this.mapId) + result = 31 * result + MessagesPigeonUtils.deepHash(this.style) + return result + } +} + +/** + * Pigeon representation of an x,y coordinate. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformPoint(val x: Long, val y: Long) { + companion object { + fun fromList(pigeonVar_list: List): PlatformPoint { + val x = pigeonVar_list[0] as Long + val y = pigeonVar_list[1] as Long + return PlatformPoint(x, y) + } + } + + fun toList(): List { + return listOf( + x, + y, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformPoint + return MessagesPigeonUtils.deepEquals(this.x, other.x) && + MessagesPigeonUtils.deepEquals(this.y, other.y) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.x) + result = 31 * result + MessagesPigeonUtils.deepHash(this.y) + return result + } +} + +/** + * Pigeon equivalent of native TileOverlay properties. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformTileLayer( + val visible: Boolean, + val fadeIn: Boolean, + val transparency: Double, + val zIndex: Double +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformTileLayer { + val visible = pigeonVar_list[0] as Boolean + val fadeIn = pigeonVar_list[1] as Boolean + val transparency = pigeonVar_list[2] as Double + val zIndex = pigeonVar_list[3] as Double + return PlatformTileLayer(visible, fadeIn, transparency, zIndex) + } + } + + fun toList(): List { + return listOf( + visible, + fadeIn, + transparency, + zIndex, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformTileLayer + return MessagesPigeonUtils.deepEquals(this.visible, other.visible) && + MessagesPigeonUtils.deepEquals(this.fadeIn, other.fadeIn) && + MessagesPigeonUtils.deepEquals(this.transparency, other.transparency) && + MessagesPigeonUtils.deepEquals(this.zIndex, other.zIndex) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.visible) + result = 31 * result + MessagesPigeonUtils.deepHash(this.fadeIn) + result = 31 * result + MessagesPigeonUtils.deepHash(this.transparency) + result = 31 * result + MessagesPigeonUtils.deepHash(this.zIndex) + return result + } +} + +/** + * Possible outcomes of launching a URL. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformZoomRange(val min: Double? = null, val max: Double? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformZoomRange { + val min = pigeonVar_list[0] as Double? + val max = pigeonVar_list[1] as Double? + return PlatformZoomRange(min, max) + } + } + + fun toList(): List { + return listOf( + min, + max, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformZoomRange + return MessagesPigeonUtils.deepEquals(this.min, other.min) && + MessagesPigeonUtils.deepEquals(this.max, other.max) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.min) + result = 31 * result + MessagesPigeonUtils.deepHash(this.max) + return result + } +} + +/** + * Pigeon equivalent of [BitmapDescriptor]. As there are multiple disjoint types of + * [BitmapDescriptor], [PlatformBitmap] contains a single field which may hold the pigeon equivalent + * type of any of them. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmap( + /** + * One of [PlatformBitmapAssetMap], [PlatformBitmapAsset], [PlatformBitmapAssetImage], + * [PlatformBitmapBytesMap], [PlatformBitmapBytes], or [PlatformBitmapDefaultMarker]. As Pigeon + * does not currently support data class inheritance, this approach allows for the different + * bitmap implementations to be valid argument and return types of the API methods. See + * https://github.com/flutter/flutter/issues/117819. + */ + val bitmap: Any +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmap { + val bitmap = pigeonVar_list[0] as Any + return PlatformBitmap(bitmap) + } + } + + fun toList(): List { + return listOf( + bitmap, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmap + return MessagesPigeonUtils.deepEquals(this.bitmap, other.bitmap) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.bitmap) + return result + } +} + +/** + * Pigeon equivalent of [DefaultMarker]. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#defaultMarker(float) + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmapDefaultMarker(val hue: Double? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmapDefaultMarker { + val hue = pigeonVar_list[0] as Double? + return PlatformBitmapDefaultMarker(hue) + } + } + + fun toList(): List { + return listOf( + hue, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmapDefaultMarker + return MessagesPigeonUtils.deepEquals(this.hue, other.hue) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.hue) + return result + } +} + +/** + * Pigeon equivalent of [BytesBitmap]. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#fromBitmap(android.graphics.Bitmap) + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmapBytes(val byteData: ByteArray, val size: PlatformDoublePair? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmapBytes { + val byteData = pigeonVar_list[0] as ByteArray + val size = pigeonVar_list[1] as PlatformDoublePair? + return PlatformBitmapBytes(byteData, size) + } + } + + fun toList(): List { + return listOf( + byteData, + size, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmapBytes + return MessagesPigeonUtils.deepEquals(this.byteData, other.byteData) && + MessagesPigeonUtils.deepEquals(this.size, other.size) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.byteData) + result = 31 * result + MessagesPigeonUtils.deepHash(this.size) + return result + } +} + +/** + * Pigeon equivalent of [AssetBitmap]. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-fromasset-string-assetname + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmapAsset(val name: String, val pkg: String? = null) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmapAsset { + val name = pigeonVar_list[0] as String + val pkg = pigeonVar_list[1] as String? + return PlatformBitmapAsset(name, pkg) + } + } + + fun toList(): List { + return listOf( + name, + pkg, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmapAsset + return MessagesPigeonUtils.deepEquals(this.name, other.name) && + MessagesPigeonUtils.deepEquals(this.pkg, other.pkg) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.name) + result = 31 * result + MessagesPigeonUtils.deepHash(this.pkg) + return result + } +} + +/** + * Pigeon equivalent of [AssetImageBitmap]. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-fromasset-string-assetname + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmapAssetImage( + val name: String, + val scale: Double, + val size: PlatformDoublePair? = null +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmapAssetImage { + val name = pigeonVar_list[0] as String + val scale = pigeonVar_list[1] as Double + val size = pigeonVar_list[2] as PlatformDoublePair? + return PlatformBitmapAssetImage(name, scale, size) + } + } + + fun toList(): List { + return listOf( + name, + scale, + size, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmapAssetImage + return MessagesPigeonUtils.deepEquals(this.name, other.name) && + MessagesPigeonUtils.deepEquals(this.scale, other.scale) && + MessagesPigeonUtils.deepEquals(this.size, other.size) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.name) + result = 31 * result + MessagesPigeonUtils.deepHash(this.scale) + result = 31 * result + MessagesPigeonUtils.deepHash(this.size) + return result + } +} + +/** + * Pigeon equivalent of [AssetMapBitmap]. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-fromasset-string-assetname + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmapAssetMap( + val assetName: String, + val bitmapScaling: PlatformMapBitmapScaling, + val imagePixelRatio: Double, + val width: Double? = null, + val height: Double? = null +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmapAssetMap { + val assetName = pigeonVar_list[0] as String + val bitmapScaling = pigeonVar_list[1] as PlatformMapBitmapScaling + val imagePixelRatio = pigeonVar_list[2] as Double + val width = pigeonVar_list[3] as Double? + val height = pigeonVar_list[4] as Double? + return PlatformBitmapAssetMap(assetName, bitmapScaling, imagePixelRatio, width, height) + } + } + + fun toList(): List { + return listOf( + assetName, + bitmapScaling, + imagePixelRatio, + width, + height, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmapAssetMap + return MessagesPigeonUtils.deepEquals(this.assetName, other.assetName) && + MessagesPigeonUtils.deepEquals(this.bitmapScaling, other.bitmapScaling) && + MessagesPigeonUtils.deepEquals(this.imagePixelRatio, other.imagePixelRatio) && + MessagesPigeonUtils.deepEquals(this.width, other.width) && + MessagesPigeonUtils.deepEquals(this.height, other.height) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.assetName) + result = 31 * result + MessagesPigeonUtils.deepHash(this.bitmapScaling) + result = 31 * result + MessagesPigeonUtils.deepHash(this.imagePixelRatio) + result = 31 * result + MessagesPigeonUtils.deepHash(this.width) + result = 31 * result + MessagesPigeonUtils.deepHash(this.height) + return result + } +} + +/** + * Pigeon equivalent of [BytesMapBitmap]. See + * https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/model/BitmapDescriptorFactory#public-static-bitmapdescriptor-frombitmap-bitmap-image + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmapBytesMap( + val byteData: ByteArray, + val bitmapScaling: PlatformMapBitmapScaling, + val imagePixelRatio: Double, + val width: Double? = null, + val height: Double? = null +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmapBytesMap { + val byteData = pigeonVar_list[0] as ByteArray + val bitmapScaling = pigeonVar_list[1] as PlatformMapBitmapScaling + val imagePixelRatio = pigeonVar_list[2] as Double + val width = pigeonVar_list[3] as Double? + val height = pigeonVar_list[4] as Double? + return PlatformBitmapBytesMap(byteData, bitmapScaling, imagePixelRatio, width, height) + } + } + + fun toList(): List { + return listOf( + byteData, + bitmapScaling, + imagePixelRatio, + width, + height, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmapBytesMap + return MessagesPigeonUtils.deepEquals(this.byteData, other.byteData) && + MessagesPigeonUtils.deepEquals(this.bitmapScaling, other.bitmapScaling) && + MessagesPigeonUtils.deepEquals(this.imagePixelRatio, other.imagePixelRatio) && + MessagesPigeonUtils.deepEquals(this.width, other.width) && + MessagesPigeonUtils.deepEquals(this.height, other.height) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.byteData) + result = 31 * result + MessagesPigeonUtils.deepHash(this.bitmapScaling) + result = 31 * result + MessagesPigeonUtils.deepHash(this.imagePixelRatio) + result = 31 * result + MessagesPigeonUtils.deepHash(this.width) + result = 31 * result + MessagesPigeonUtils.deepHash(this.height) + return result + } +} + +/** + * Pigeon equivalent of [PinConfig]. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class PlatformBitmapPinConfig( + val backgroundColor: PlatformColor? = null, + val borderColor: PlatformColor? = null, + val glyphColor: PlatformColor? = null, + val glyphBitmap: PlatformBitmap? = null, + val glyphText: String? = null, + val glyphTextColor: PlatformColor? = null +) { + companion object { + fun fromList(pigeonVar_list: List): PlatformBitmapPinConfig { + val backgroundColor = pigeonVar_list[0] as PlatformColor? + val borderColor = pigeonVar_list[1] as PlatformColor? + val glyphColor = pigeonVar_list[2] as PlatformColor? + val glyphBitmap = pigeonVar_list[3] as PlatformBitmap? + val glyphText = pigeonVar_list[4] as String? + val glyphTextColor = pigeonVar_list[5] as PlatformColor? + return PlatformBitmapPinConfig( + backgroundColor, borderColor, glyphColor, glyphBitmap, glyphText, glyphTextColor) + } + } + + fun toList(): List { + return listOf( + backgroundColor, + borderColor, + glyphColor, + glyphBitmap, + glyphText, + glyphTextColor, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as PlatformBitmapPinConfig + return MessagesPigeonUtils.deepEquals(this.backgroundColor, other.backgroundColor) && + MessagesPigeonUtils.deepEquals(this.borderColor, other.borderColor) && + MessagesPigeonUtils.deepEquals(this.glyphColor, other.glyphColor) && + MessagesPigeonUtils.deepEquals(this.glyphBitmap, other.glyphBitmap) && + MessagesPigeonUtils.deepEquals(this.glyphText, other.glyphText) && + MessagesPigeonUtils.deepEquals(this.glyphTextColor, other.glyphTextColor) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.backgroundColor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.borderColor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.glyphColor) + result = 31 * result + MessagesPigeonUtils.deepHash(this.glyphBitmap) + result = 31 * result + MessagesPigeonUtils.deepHash(this.glyphText) + result = 31 * result + MessagesPigeonUtils.deepHash(this.glyphTextColor) + return result + } +} + +private open class MessagesPigeonCodec : StandardMessageCodec() { + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return when (type) { + 129.toByte() -> { + return (readValue(buffer) as Long?)?.let { PlatformMapType.ofRaw(it.toInt()) } + } + 130.toByte() -> { + return (readValue(buffer) as Long?)?.let { PlatformRendererType.ofRaw(it.toInt()) } + } + 131.toByte() -> { + return (readValue(buffer) as Long?)?.let { + PlatformMarkerCollisionBehavior.ofRaw(it.toInt()) + } + } + 132.toByte() -> { + return (readValue(buffer) as Long?)?.let { PlatformJointType.ofRaw(it.toInt()) } + } + 133.toByte() -> { + return (readValue(buffer) as Long?)?.let { PlatformCapType.ofRaw(it.toInt()) } + } + 134.toByte() -> { + return (readValue(buffer) as Long?)?.let { PlatformPatternItemType.ofRaw(it.toInt()) } + } + 135.toByte() -> { + return (readValue(buffer) as Long?)?.let { PlatformMarkerType.ofRaw(it.toInt()) } + } + 136.toByte() -> { + return (readValue(buffer) as Long?)?.let { PlatformMapBitmapScaling.ofRaw(it.toInt()) } + } + 137.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCameraPosition.fromList(it) } + } + 138.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCameraUpdate.fromList(it) } + } + 139.toByte() -> { + return (readValue(buffer) as? List)?.let { + PlatformCameraUpdateNewCameraPosition.fromList(it) + } + } + 140.toByte() -> { + return (readValue(buffer) as? List)?.let { + PlatformCameraUpdateNewLatLng.fromList(it) + } + } + 141.toByte() -> { + return (readValue(buffer) as? List)?.let { + PlatformCameraUpdateNewLatLngBounds.fromList(it) + } + } + 142.toByte() -> { + return (readValue(buffer) as? List)?.let { + PlatformCameraUpdateNewLatLngZoom.fromList(it) + } + } + 143.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCameraUpdateScrollBy.fromList(it) } + } + 144.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCameraUpdateZoomBy.fromList(it) } + } + 145.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCameraUpdateZoom.fromList(it) } + } + 146.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCameraUpdateZoomTo.fromList(it) } + } + 147.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCircle.fromList(it) } + } + 148.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformHeatmap.fromList(it) } + } + 149.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformHeatmapGradient.fromList(it) } + } + 150.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformWeightedLatLng.fromList(it) } + } + 151.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformClusterManager.fromList(it) } + } + 152.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformDoublePair.fromList(it) } + } + 153.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformColor.fromList(it) } + } + 154.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformInfoWindow.fromList(it) } + } + 155.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformMarker.fromList(it) } + } + 156.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformPolygon.fromList(it) } + } + 157.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformPolyline.fromList(it) } + } + 158.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCap.fromList(it) } + } + 159.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformPatternItem.fromList(it) } + } + 160.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformTile.fromList(it) } + } + 161.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformTileOverlay.fromList(it) } + } + 162.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformEdgeInsets.fromList(it) } + } + 163.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformLatLng.fromList(it) } + } + 164.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformLatLngBounds.fromList(it) } + } + 165.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCluster.fromList(it) } + } + 166.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformGroundOverlay.fromList(it) } + } + 167.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformCameraTargetBounds.fromList(it) } + } + 168.toByte() -> { + return (readValue(buffer) as? List)?.let { + PlatformMapViewCreationParams.fromList(it) + } + } + 169.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformMapConfiguration.fromList(it) } + } + 170.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformPoint.fromList(it) } + } + 171.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformTileLayer.fromList(it) } + } + 172.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformZoomRange.fromList(it) } + } + 173.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmap.fromList(it) } + } + 174.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmapDefaultMarker.fromList(it) } + } + 175.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmapBytes.fromList(it) } + } + 176.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmapAsset.fromList(it) } + } + 177.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmapAssetImage.fromList(it) } + } + 178.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmapAssetMap.fromList(it) } + } + 179.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmapBytesMap.fromList(it) } + } + 180.toByte() -> { + return (readValue(buffer) as? List)?.let { PlatformBitmapPinConfig.fromList(it) } + } + else -> super.readValueOfType(type, buffer) + } + } + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + when (value) { + is PlatformMapType -> { + stream.write(129) + writeValue(stream, value.raw.toLong()) + } + is PlatformRendererType -> { + stream.write(130) + writeValue(stream, value.raw.toLong()) + } + is PlatformMarkerCollisionBehavior -> { + stream.write(131) + writeValue(stream, value.raw.toLong()) + } + is PlatformJointType -> { + stream.write(132) + writeValue(stream, value.raw.toLong()) + } + is PlatformCapType -> { + stream.write(133) + writeValue(stream, value.raw.toLong()) + } + is PlatformPatternItemType -> { + stream.write(134) + writeValue(stream, value.raw.toLong()) + } + is PlatformMarkerType -> { + stream.write(135) + writeValue(stream, value.raw.toLong()) + } + is PlatformMapBitmapScaling -> { + stream.write(136) + writeValue(stream, value.raw.toLong()) + } + is PlatformCameraPosition -> { + stream.write(137) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdate -> { + stream.write(138) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateNewCameraPosition -> { + stream.write(139) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateNewLatLng -> { + stream.write(140) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateNewLatLngBounds -> { + stream.write(141) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateNewLatLngZoom -> { + stream.write(142) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateScrollBy -> { + stream.write(143) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateZoomBy -> { + stream.write(144) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateZoom -> { + stream.write(145) + writeValue(stream, value.toList()) + } + is PlatformCameraUpdateZoomTo -> { + stream.write(146) + writeValue(stream, value.toList()) + } + is PlatformCircle -> { + stream.write(147) + writeValue(stream, value.toList()) + } + is PlatformHeatmap -> { + stream.write(148) + writeValue(stream, value.toList()) + } + is PlatformHeatmapGradient -> { + stream.write(149) + writeValue(stream, value.toList()) + } + is PlatformWeightedLatLng -> { + stream.write(150) + writeValue(stream, value.toList()) + } + is PlatformClusterManager -> { + stream.write(151) + writeValue(stream, value.toList()) + } + is PlatformDoublePair -> { + stream.write(152) + writeValue(stream, value.toList()) + } + is PlatformColor -> { + stream.write(153) + writeValue(stream, value.toList()) + } + is PlatformInfoWindow -> { + stream.write(154) + writeValue(stream, value.toList()) + } + is PlatformMarker -> { + stream.write(155) + writeValue(stream, value.toList()) + } + is PlatformPolygon -> { + stream.write(156) + writeValue(stream, value.toList()) + } + is PlatformPolyline -> { + stream.write(157) + writeValue(stream, value.toList()) + } + is PlatformCap -> { + stream.write(158) + writeValue(stream, value.toList()) + } + is PlatformPatternItem -> { + stream.write(159) + writeValue(stream, value.toList()) + } + is PlatformTile -> { + stream.write(160) + writeValue(stream, value.toList()) + } + is PlatformTileOverlay -> { + stream.write(161) + writeValue(stream, value.toList()) + } + is PlatformEdgeInsets -> { + stream.write(162) + writeValue(stream, value.toList()) + } + is PlatformLatLng -> { + stream.write(163) + writeValue(stream, value.toList()) + } + is PlatformLatLngBounds -> { + stream.write(164) + writeValue(stream, value.toList()) + } + is PlatformCluster -> { + stream.write(165) + writeValue(stream, value.toList()) + } + is PlatformGroundOverlay -> { + stream.write(166) + writeValue(stream, value.toList()) + } + is PlatformCameraTargetBounds -> { + stream.write(167) + writeValue(stream, value.toList()) + } + is PlatformMapViewCreationParams -> { + stream.write(168) + writeValue(stream, value.toList()) + } + is PlatformMapConfiguration -> { + stream.write(169) + writeValue(stream, value.toList()) + } + is PlatformPoint -> { + stream.write(170) + writeValue(stream, value.toList()) + } + is PlatformTileLayer -> { + stream.write(171) + writeValue(stream, value.toList()) + } + is PlatformZoomRange -> { + stream.write(172) + writeValue(stream, value.toList()) + } + is PlatformBitmap -> { + stream.write(173) + writeValue(stream, value.toList()) + } + is PlatformBitmapDefaultMarker -> { + stream.write(174) + writeValue(stream, value.toList()) + } + is PlatformBitmapBytes -> { + stream.write(175) + writeValue(stream, value.toList()) + } + is PlatformBitmapAsset -> { + stream.write(176) + writeValue(stream, value.toList()) + } + is PlatformBitmapAssetImage -> { + stream.write(177) + writeValue(stream, value.toList()) + } + is PlatformBitmapAssetMap -> { + stream.write(178) + writeValue(stream, value.toList()) + } + is PlatformBitmapBytesMap -> { + stream.write(179) + writeValue(stream, value.toList()) + } + is PlatformBitmapPinConfig -> { + stream.write(180) + writeValue(stream, value.toList()) + } + else -> super.writeValue(stream, value) + } + } +} + +/** + * Interface for non-test interactions with the native SDK. + * + * For test-only state queries, see [MapsInspectorApi]. + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ +interface MapsApi { + /** Returns once the map instance is available. */ + fun waitForMap(callback: (Result) -> Unit) + /** + * Updates the map's configuration options. + * + * Only non-null configuration values will result in updates; options with null values will remain + * unchanged. + */ + fun updateMapConfiguration(configuration: PlatformMapConfiguration) + /** Updates the set of circles on the map. */ + fun updateCircles( + toAdd: List, + toChange: List, + idsToRemove: List + ) + /** Updates the set of heatmaps on the map. */ + fun updateHeatmaps( + toAdd: List, + toChange: List, + idsToRemove: List + ) + /** Updates the set of custer managers for clusters on the map. */ + fun updateClusterManagers(toAdd: List, idsToRemove: List) + /** Updates the set of markers on the map. */ + fun updateMarkers( + toAdd: List, + toChange: List, + idsToRemove: List + ) + /** Updates the set of polygonss on the map. */ + fun updatePolygons( + toAdd: List, + toChange: List, + idsToRemove: List + ) + /** Updates the set of polylines on the map. */ + fun updatePolylines( + toAdd: List, + toChange: List, + idsToRemove: List + ) + /** Updates the set of tile overlays on the map. */ + fun updateTileOverlays( + toAdd: List, + toChange: List, + idsToRemove: List + ) + /** Updates the set of ground overlays on the map. */ + fun updateGroundOverlays( + toAdd: List, + toChange: List, + idsToRemove: List + ) + /** Gets the screen coordinate for the given map location. */ + fun getScreenCoordinate(latLng: PlatformLatLng): PlatformPoint + /** Gets the map location for the given screen coordinate. */ + fun getLatLng(screenCoordinate: PlatformPoint): PlatformLatLng + /** Gets the map region currently displayed on the map. */ + fun getVisibleRegion(): PlatformLatLngBounds + /** Moves the camera according to [cameraUpdate] immediately, with no animation. */ + fun moveCamera(cameraUpdate: PlatformCameraUpdate) + /** + * Moves the camera according to [cameraUpdate], animating the update using a duration in + * milliseconds if provided. + */ + fun animateCamera(cameraUpdate: PlatformCameraUpdate, durationMilliseconds: Long?) + /** Gets the current map zoom level. */ + fun getZoomLevel(): Double + /** Show the info window for the marker with the given ID. */ + fun showInfoWindow(markerId: String) + /** Hide the info window for the marker with the given ID. */ + fun hideInfoWindow(markerId: String) + /** Returns true if the marker with the given ID is currently displaying its info window. */ + fun isInfoWindowShown(markerId: String): Boolean + /** + * Sets the style to the given map style string, where an empty string indicates that the style + * should be cleared. + * + * Returns false if there was an error setting the style, such as an invalid style string. + */ + fun setStyle(style: String): Boolean + /** + * Returns true if the last attempt to set a style, either via initial map style or setMapStyle, + * succeeded. + * + * This allows checking asynchronously for initial style failures, as there is no way to return + * failures from map initialization. + */ + fun didLastStyleSucceed(): Boolean + /** + * Returns true if this map supports advanced markers. + * + * This allows checking if the map supports advanced markers before attempting to use them. + */ + fun isAdvancedMarkersAvailable(): Boolean + /** Clears the cache of tiles previously requseted from the tile provider. */ + fun clearTileCache(tileOverlayId: String) + /** Takes a snapshot of the map and returns its image data. */ + fun takeSnapshot(callback: (Result) -> Unit) + + companion object { + /** The codec used by MapsApi. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + /** Sets up an instance of `MapsApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: MapsApi?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.waitForMap$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + api.waitForMap { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(MessagesPigeonUtils.wrapError(error)) + } else { + reply.reply(MessagesPigeonUtils.wrapResult(null)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateMapConfiguration$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val configurationArg = args[0] as PlatformMapConfiguration + val wrapped: List = + try { + api.updateMapConfiguration(configurationArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateCircles$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val toChangeArg = args[1] as List + val idsToRemoveArg = args[2] as List + val wrapped: List = + try { + api.updateCircles(toAddArg, toChangeArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateHeatmaps$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val toChangeArg = args[1] as List + val idsToRemoveArg = args[2] as List + val wrapped: List = + try { + api.updateHeatmaps(toAddArg, toChangeArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateClusterManagers$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val idsToRemoveArg = args[1] as List + val wrapped: List = + try { + api.updateClusterManagers(toAddArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateMarkers$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val toChangeArg = args[1] as List + val idsToRemoveArg = args[2] as List + val wrapped: List = + try { + api.updateMarkers(toAddArg, toChangeArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updatePolygons$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val toChangeArg = args[1] as List + val idsToRemoveArg = args[2] as List + val wrapped: List = + try { + api.updatePolygons(toAddArg, toChangeArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updatePolylines$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val toChangeArg = args[1] as List + val idsToRemoveArg = args[2] as List + val wrapped: List = + try { + api.updatePolylines(toAddArg, toChangeArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateTileOverlays$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val toChangeArg = args[1] as List + val idsToRemoveArg = args[2] as List + val wrapped: List = + try { + api.updateTileOverlays(toAddArg, toChangeArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.updateGroundOverlays$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val toAddArg = args[0] as List + val toChangeArg = args[1] as List + val idsToRemoveArg = args[2] as List + val wrapped: List = + try { + api.updateGroundOverlays(toAddArg, toChangeArg, idsToRemoveArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getScreenCoordinate$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val latLngArg = args[0] as PlatformLatLng + val wrapped: List = + try { + listOf(api.getScreenCoordinate(latLngArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getLatLng$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val screenCoordinateArg = args[0] as PlatformPoint + val wrapped: List = + try { + listOf(api.getLatLng(screenCoordinateArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getVisibleRegion$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.getVisibleRegion()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.moveCamera$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val cameraUpdateArg = args[0] as PlatformCameraUpdate + val wrapped: List = + try { + api.moveCamera(cameraUpdateArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.animateCamera$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val cameraUpdateArg = args[0] as PlatformCameraUpdate + val durationMillisecondsArg = args[1] as Long? + val wrapped: List = + try { + api.animateCamera(cameraUpdateArg, durationMillisecondsArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.getZoomLevel$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.getZoomLevel()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.showInfoWindow$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val markerIdArg = args[0] as String + val wrapped: List = + try { + api.showInfoWindow(markerIdArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.hideInfoWindow$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val markerIdArg = args[0] as String + val wrapped: List = + try { + api.hideInfoWindow(markerIdArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.isInfoWindowShown$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val markerIdArg = args[0] as String + val wrapped: List = + try { + listOf(api.isInfoWindowShown(markerIdArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.setStyle$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val styleArg = args[0] as String + val wrapped: List = + try { + listOf(api.setStyle(styleArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.didLastStyleSucceed$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.didLastStyleSucceed()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.isAdvancedMarkersAvailable$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.isAdvancedMarkersAvailable()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.clearTileCache$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val tileOverlayIdArg = args[0] as String + val wrapped: List = + try { + api.clearTileCache(tileOverlayIdArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsApi.takeSnapshot$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + api.takeSnapshot { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(MessagesPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(MessagesPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ +class MapsCallbackApi( + private val binaryMessenger: BinaryMessenger, + private val messageChannelSuffix: String = "" +) { + companion object { + /** The codec used by MapsCallbackApi. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + } + /** Called when the map camera starts moving. */ + fun onCameraMoveStarted(callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMoveStarted$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when the map camera moves. */ + fun onCameraMove(cameraPositionArg: PlatformCameraPosition, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMove$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(cameraPositionArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when the map camera stops moving. */ + fun onCameraIdle(callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraIdle$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(null) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when the map, not a specifc map object, is tapped. */ + fun onTap(positionArg: PlatformLatLng, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(positionArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when the map, not a specifc map object, is long pressed. */ + fun onLongPress(positionArg: PlatformLatLng, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onLongPress$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(positionArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a marker is tapped. */ + fun onMarkerTap(markerIdArg: String, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(markerIdArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a marker drag starts. */ + fun onMarkerDragStart( + markerIdArg: String, + positionArg: PlatformLatLng, + callback: (Result) -> Unit + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragStart$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(markerIdArg, positionArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a marker drag updates. */ + fun onMarkerDrag( + markerIdArg: String, + positionArg: PlatformLatLng, + callback: (Result) -> Unit + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDrag$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(markerIdArg, positionArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a marker drag ends. */ + fun onMarkerDragEnd( + markerIdArg: String, + positionArg: PlatformLatLng, + callback: (Result) -> Unit + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragEnd$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(markerIdArg, positionArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a marker's info window is tapped. */ + fun onInfoWindowTap(markerIdArg: String, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onInfoWindowTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(markerIdArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a circle is tapped. */ + fun onCircleTap(circleIdArg: String, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCircleTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(circleIdArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a marker cluster is tapped. */ + fun onClusterTap(clusterArg: PlatformCluster, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onClusterTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(clusterArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a polygon is tapped. */ + fun onPolygonTap(polygonIdArg: String, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolygonTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(polygonIdArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a polyline is tapped. */ + fun onPolylineTap(polylineIdArg: String, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolylineTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(polylineIdArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called when a ground overlay is tapped. */ + fun onGroundOverlayTap(groundOverlayIdArg: String, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onGroundOverlayTap$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(groundOverlayIdArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } + /** Called to get data for a map tile. */ + fun getTileOverlayTile( + tileOverlayIdArg: String, + locationArg: PlatformPoint, + zoomArg: Long, + callback: (Result) -> Unit + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.getTileOverlayTile$separatedMessageChannelSuffix" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(tileOverlayIdArg, locationArg, zoomArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?))) + } else if (it[0] == null) { + callback( + Result.failure( + FlutterError( + "null-error", + "Flutter api returned null value for non-null return value.", + ""))) + } else { + val output = it[0] as PlatformTile + callback(Result.success(output)) + } + } else { + callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) + } + } + } +} +/** + * Interface for global SDK initialization. + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ +interface MapsInitializerApi { + /** + * Initializes the Google Maps SDK with the given renderer preference. + * + * A null renderer preference will result in the default renderer. + * + * Calling this more than once in the lifetime of an application will result in an error. + */ + fun initializeWithPreferredRenderer( + type: PlatformRendererType?, + callback: (Result) -> Unit + ) + /** + * Attempts to trigger any thread-blocking work the Google Maps SDK normally does when a map is + * shown for the first time. + */ + fun warmup() + + companion object { + /** The codec used by MapsInitializerApi. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + /** + * Sets up an instance of `MapsInitializerApi` to handle messages through the `binaryMessenger`. + */ + @JvmOverloads + fun setUp( + binaryMessenger: BinaryMessenger, + api: MapsInitializerApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.initializeWithPreferredRenderer$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val typeArg = args[0] as PlatformRendererType? + api.initializeWithPreferredRenderer(typeArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(MessagesPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(MessagesPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInitializerApi.warmup$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + api.warmup() + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** + * Dummy interface to force generation of the platform view creation params, which are not used in + * any Pigeon calls, only the platform view creation call made internally by Flutter. + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ +interface MapsPlatformViewApi { + fun createView(type: PlatformMapViewCreationParams?) + + companion object { + /** The codec used by MapsPlatformViewApi. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + /** + * Sets up an instance of `MapsPlatformViewApi` to handle messages through the + * `binaryMessenger`. + */ + @JvmOverloads + fun setUp( + binaryMessenger: BinaryMessenger, + api: MapsPlatformViewApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsPlatformViewApi.createView$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val typeArg = args[0] as PlatformMapViewCreationParams? + val wrapped: List = + try { + api.createView(typeArg) + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} +/** + * Inspector API only intended for use in integration tests. + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ +interface MapsInspectorApi { + fun areBuildingsEnabled(): Boolean + + fun areRotateGesturesEnabled(): Boolean + + fun areZoomControlsEnabled(): Boolean + + fun areScrollGesturesEnabled(): Boolean + + fun areTiltGesturesEnabled(): Boolean + + fun areZoomGesturesEnabled(): Boolean + + fun isCompassEnabled(): Boolean + + fun isLiteModeEnabled(): Boolean? + + fun isMapToolbarEnabled(): Boolean + + fun isMyLocationButtonEnabled(): Boolean + + fun isTrafficEnabled(): Boolean + + fun getTileOverlayInfo(tileOverlayId: String): PlatformTileLayer? + + fun getGroundOverlayInfo(groundOverlayId: String): PlatformGroundOverlay? + + fun getZoomRange(): PlatformZoomRange + + fun getClusters(clusterManagerId: String): List + + fun getCameraPosition(): PlatformCameraPosition + + companion object { + /** The codec used by MapsInspectorApi. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + /** + * Sets up an instance of `MapsInspectorApi` to handle messages through the `binaryMessenger`. + */ + @JvmOverloads + fun setUp( + binaryMessenger: BinaryMessenger, + api: MapsInspectorApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areBuildingsEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.areBuildingsEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areRotateGesturesEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.areRotateGesturesEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areZoomControlsEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.areZoomControlsEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areScrollGesturesEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.areScrollGesturesEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areTiltGesturesEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.areTiltGesturesEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.areZoomGesturesEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.areZoomGesturesEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isCompassEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.isCompassEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isLiteModeEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.isLiteModeEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isMapToolbarEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.isMapToolbarEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isMyLocationButtonEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.isMyLocationButtonEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.isTrafficEnabled$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.isTrafficEnabled()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getTileOverlayInfo$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val tileOverlayIdArg = args[0] as String + val wrapped: List = + try { + listOf(api.getTileOverlayInfo(tileOverlayIdArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getGroundOverlayInfo$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val groundOverlayIdArg = args[0] as String + val wrapped: List = + try { + listOf(api.getGroundOverlayInfo(groundOverlayIdArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getZoomRange$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.getZoomRange()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getClusters$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val clusterManagerIdArg = args[0] as String + val wrapped: List = + try { + listOf(api.getClusters(clusterManagerIdArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.google_maps_flutter_android.MapsInspectorApi.getCameraPosition$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.getCameraPosition()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/kotlin/io/flutter/plugins/googlemaps/ResultUtils.kt b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/kotlin/io/flutter/plugins/googlemaps/ResultUtils.kt new file mode 100644 index 000000000000..6d28d78d8797 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/kotlin/io/flutter/plugins/googlemaps/ResultUtils.kt @@ -0,0 +1,46 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.googlemaps + +fun completeWithError(callback: (Result<@JvmSuppressWildcards T>) -> Unit, failure: Throwable) { + callback(Result.failure(failure)) +} + +fun completeWithValue(callback: (Result<@JvmSuppressWildcards T>) -> Unit, value: T) { + callback(Result.success(value)) +} + +fun completeWithUnitSuccess(callback: (Result) -> Unit) { + callback(Result.success(Unit)) +} + +@Suppress("UNCHECKED_CAST") +class ResultCompat(private val result: Result) { + private val value: T? = result.getOrNull() + private val exception = result.exceptionOrNull() + val isSuccess = result.isSuccess + val isFailure = result.isFailure + + companion object { + @JvmStatic + fun success(value: T, callback: Any) { + val castedCallback: (Result) -> Unit = callback as (Result) -> Unit + castedCallback(Result.success(value)) + } + + @JvmStatic + fun asCompatCallback(result: (ResultCompat) -> Unit): (Result) -> Unit { + return { result(ResultCompat(it)) } + } + } + + fun getOrNull(): T? { + return value + } + + fun exceptionOrNull(): Throwable? { + return exception + } +} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java index dcd07ecd6c75..c85be2adf183 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java @@ -48,26 +48,27 @@ public void controller_changeCircles_updatesExistingCircle() { final String id = "a_circle"; - final Messages.PlatformCircle.Builder builder = new Messages.PlatformCircle.Builder(); - builder - .setCircleId(id) - .setConsumeTapEvents(false) - .setFillColor(new Messages.PlatformColor.Builder().setArgbValue(0L).build()) - .setCenter(new Messages.PlatformLatLng.Builder().setLatitude(0.0).setLongitude(0.0).build()) - .setRadius(1.0) - .setStrokeColor(new Messages.PlatformColor.Builder().setArgbValue(0L).build()) - .setStrokeWidth(1L) - .setVisible(true) - .setZIndex(0.0); - - controller.addCircles(Collections.singletonList(builder.build())); + controller.addCircles(Collections.singletonList(createCircle(id, /* consumesEvents */ false))); // There should be exactly one circle. Assert.assertEquals(1, controller.circleIdToController.size()); - builder.setConsumeTapEvents(true); - controller.changeCircles(Collections.singletonList(builder.build())); + controller.changeCircles( + Collections.singletonList(createCircle(id, /* consumesEvents */ true))); // There should still only be one circle, and it should be updated. Assert.assertEquals(1, controller.circleIdToController.size()); verify(circle, times(1)).setClickable(true); } + + private PlatformCircle createCircle(String circleId, boolean consumesEvents) { + return new PlatformCircle( + consumesEvents, + /* fillColor */ new PlatformColor(0L), + /* strokeColor */ new PlatformColor(0L), + /* visible */ true, + /* strokeWidth */ 1L, + /* zIndex */ 0.0, + /* center */ (new PlatformLatLng(0.0, 0.0)), + /* radius */ 1.0, + circleId); + } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java index 4c3e96c53eb2..d9861ffd26b2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ClusterManagersControllerTest.java @@ -28,9 +28,6 @@ import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.googlemaps.ClusterManagersController.AdvancedMarkerClusterRenderer; import io.flutter.plugins.googlemaps.ClusterManagersController.MarkerClusterRenderer; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerCollisionBehavior; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; @@ -66,7 +63,7 @@ public void setUp() { mocksClosable = MockitoAnnotations.openMocks(this); context = ApplicationProvider.getApplicationContext(); assetManager = context.getAssets(); - flutterApi = spy(new MapsCallbackApi(mock(BinaryMessenger.class))); + flutterApi = spy(new MapsCallbackApi(mock(BinaryMessenger.class), "")); controller = spy(new ClusterManagersController(flutterApi, context, PlatformMarkerType.MARKER)); googleMap = mock(GoogleMap.class); markerManager = new MarkerManager(googleMap); @@ -97,9 +94,8 @@ public void AddClusterManagersAndMarkers() { when(googleMap.getCameraPosition()) .thenReturn(CameraPosition.builder().target(new LatLng(0, 0)).build()); - Messages.PlatformClusterManager initialClusterManager = - new Messages.PlatformClusterManager.Builder().setIdentifier(clusterManagerId).build(); - List clusterManagersToAdd = new ArrayList<>(); + PlatformClusterManager initialClusterManager = new PlatformClusterManager(clusterManagerId); + List clusterManagersToAdd = new ArrayList<>(); clusterManagersToAdd.add(initialClusterManager); controller.addClusterManagers(clusterManagersToAdd); @@ -108,10 +104,8 @@ public void AddClusterManagersAndMarkers() { MarkerBuilder markerBuilder2 = new MarkerBuilder(markerId2, clusterManagerId, PlatformMarkerType.MARKER); - final Messages.PlatformMarker markerData1 = - createPlatformMarker(markerId1, location1, clusterManagerId); - final Messages.PlatformMarker markerData2 = - createPlatformMarker(markerId2, location2, clusterManagerId); + final PlatformMarker markerData1 = createPlatformMarker(markerId1, location1, clusterManagerId); + final PlatformMarker markerData2 = createPlatformMarker(markerId2, location2, clusterManagerId); Convert.interpretMarkerOptions( markerData1, markerBuilder1, assetManager, density, bitmapFactory); @@ -153,19 +147,15 @@ public void SelectClusterRenderer() { spy(new ClusterManagersController(flutterApi, context, PlatformMarkerType.ADVANCED_MARKER)); advancedController.init(googleMap, markerManager); - Messages.PlatformClusterManager initialClusterManager1 = - new Messages.PlatformClusterManager.Builder() - .setIdentifier(defaultClusterManagerId) - .build(); - List clusterManagersToAdd1 = new ArrayList<>(); + PlatformClusterManager initialClusterManager1 = + new PlatformClusterManager(defaultClusterManagerId); + List clusterManagersToAdd1 = new ArrayList<>(); clusterManagersToAdd1.add(initialClusterManager1); defaultController.addClusterManagers(clusterManagersToAdd1); - Messages.PlatformClusterManager initialClusterManager2 = - new Messages.PlatformClusterManager.Builder() - .setIdentifier(advancedClusterManagerId) - .build(); - List clusterManagersToAdd2 = new ArrayList<>(); + PlatformClusterManager initialClusterManager2 = + new PlatformClusterManager(advancedClusterManagerId); + List clusterManagersToAdd2 = new ArrayList<>(); clusterManagersToAdd2.add(initialClusterManager2); advancedController.addClusterManagers(clusterManagersToAdd2); @@ -220,9 +210,8 @@ public void RemoveClusterManagers() { when(googleMap.getCameraPosition()) .thenReturn(CameraPosition.builder().target(new LatLng(0, 0)).build()); - Messages.PlatformClusterManager initialClusterManager = - new Messages.PlatformClusterManager.Builder().setIdentifier(clusterManagerId).build(); - List clusterManagersToAdd = new ArrayList<>(); + PlatformClusterManager initialClusterManager = new PlatformClusterManager(clusterManagerId); + List clusterManagersToAdd = new ArrayList<>(); clusterManagersToAdd.add(initialClusterManager); controller.addClusterManagers(clusterManagersToAdd); @@ -232,46 +221,35 @@ public void RemoveClusterManagers() { controller.removeClusterManagers(Collections.singletonList(clusterManagerId)); // Verify that fetching the cluster data fails and therefore ClusterManager is removed. assertThrows( - Messages.FlutterError.class, - () -> controller.getClustersWithClusterManagerId(clusterManagerId)); + FlutterError.class, () -> controller.getClustersWithClusterManagerId(clusterManagerId)); } - private Messages.PlatformMarker createPlatformMarker( + private PlatformMarker createPlatformMarker( String markerId, List location, String clusterManagerId) { Bitmap fakeBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fakeBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); - Messages.PlatformBitmap icon = - new Messages.PlatformBitmap.Builder() - .setBitmap( - new Messages.PlatformBitmapBytesMap.Builder() - .setByteData(byteArray) - .setImagePixelRatio(1.0) - .setBitmapScaling(Messages.PlatformMapBitmapScaling.NONE) - .build()) - .build(); - Messages.PlatformDoublePair anchor = - new Messages.PlatformDoublePair.Builder().setX(0.0).setY(0.0).build(); - return new Messages.PlatformMarker.Builder() - .setMarkerId(markerId) - .setConsumeTapEvents(false) - .setIcon(icon) - .setAlpha(1.0) - .setDraggable(false) - .setFlat(false) - .setVisible(true) - .setRotation(0.0) - .setZIndex(0.0) - .setPosition( - new Messages.PlatformLatLng.Builder() - .setLatitude(location.get(0)) - .setLongitude(location.get(1)) - .build()) - .setClusterManagerId(clusterManagerId) - .setAnchor(anchor) - .setInfoWindow(new Messages.PlatformInfoWindow.Builder().setAnchor(anchor).build()) - .setCollisionBehavior(PlatformMarkerCollisionBehavior.REQUIRED_DISPLAY) - .build(); + PlatformBitmap icon = + new PlatformBitmap( + new PlatformBitmapBytesMap( + byteArray, PlatformMapBitmapScaling.NONE, /* imagePixelRatio */ 1.0, null, null)); + PlatformDoublePair anchor = new PlatformDoublePair(0.0, 0.0); + return new PlatformMarker( + /* alpha */ 1.0, + anchor, + /* consumeTapEvents */ false, + /* draggable */ false, + /* flat */ false, + icon, + new PlatformInfoWindow(/* title */ null, /* snippet */ null, anchor), + /* position */ + new PlatformLatLng(location.get(0), location.get(1)), + /* rotation */ 0.0, + /* visible */ true, + /* zIndex */ 0.0, + markerId, + clusterManagerId, + PlatformMarkerCollisionBehavior.REQUIRED_DISPLAY); } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java index 1e7d9f881498..7c518675abdf 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/ConvertTest.java @@ -18,6 +18,7 @@ import android.content.res.AssetManager; import android.util.Base64; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.android.gms.maps.model.BitmapDescriptor; import com.google.android.gms.maps.model.GroundOverlay; import com.google.android.gms.maps.model.LatLng; @@ -30,9 +31,9 @@ import com.google.maps.android.projection.SphericalMercatorProjection; import io.flutter.plugins.googlemaps.Convert.BitmapDescriptorFactoryWrapper; import io.flutter.plugins.googlemaps.Convert.FlutterInjectorWrapper; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.util.Collections; import java.util.List; +import java.util.Objects; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -74,8 +75,7 @@ public void tearDown() throws Exception { public void ConvertPointsFromPigeonConvertsThePointsWithFullPrecision() { double latitude = 43.03725568057; double longitude = -87.90466904649; - Messages.PlatformLatLng platLng = - new Messages.PlatformLatLng.Builder().setLatitude(latitude).setLongitude(longitude).build(); + PlatformLatLng platLng = new PlatformLatLng(latitude, longitude); List latLngs = Convert.pointsFromPigeon(Collections.singletonList(platLng)); LatLng latLng = latLngs.get(0); Assert.assertEquals(latitude, latLng.latitude, 1e-15); @@ -99,16 +99,16 @@ public void ConvertClusterToPigeonReturnsCorrectData() { marker2.setPosition(markerPosition2); cluster.add(marker2); - Messages.PlatformCluster result = Convert.clusterToPigeon(clusterManagerId, cluster); + PlatformCluster result = Convert.clusterToPigeon(clusterManagerId, cluster); Assert.assertEquals(clusterManagerId, result.getClusterManagerId()); - Messages.PlatformLatLng position = result.getPosition(); + PlatformLatLng position = result.getPosition(); Assert.assertEquals(clusterPosition.latitude, position.getLatitude(), 1e-15); Assert.assertEquals(clusterPosition.longitude, position.getLongitude(), 1e-15); - Messages.PlatformLatLngBounds bounds = result.getBounds(); - Messages.PlatformLatLng southwest = bounds.getSouthwest(); - Messages.PlatformLatLng northeast = bounds.getNortheast(); + PlatformLatLngBounds bounds = result.getBounds(); + PlatformLatLng southwest = bounds.getSouthwest(); + PlatformLatLng northeast = bounds.getNortheast(); // bounding data should combine data from marker positions markerPosition1 and markerPosition2 Assert.assertEquals(markerPosition2.latitude, southwest.getLatitude(), 1e-15); Assert.assertEquals(markerPosition1.longitude, southwest.getLongitude(), 1e-15); @@ -131,14 +131,13 @@ public void GetBitmapFromAssetAuto() throws Exception { when(assetManager.open(fakeAssetKey)).thenReturn(TestImageUtils.buildImageInputStream()); when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); - Messages.PlatformBitmapAssetMap bitmap = - new Messages.PlatformBitmapAssetMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .setWidth(15.0) - .setHeight(15.0) - .setImagePixelRatio(2.0) - .setAssetName(fakeAssetName) - .build(); + PlatformBitmapAssetMap bitmap = + new PlatformBitmapAssetMap( + fakeAssetName, + PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ 15.0, + /* height */ 15.0); BitmapDescriptor result = Convert.getBitmapFromAsset( @@ -157,13 +156,13 @@ public void GetBitmapFromAssetAutoAndWidth() throws Exception { when(assetManager.open(fakeAssetKey)).thenReturn(TestImageUtils.buildImageInputStream()); when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); - Messages.PlatformBitmapAssetMap bitmap = - new Messages.PlatformBitmapAssetMap.Builder() - .setAssetName(fakeAssetName) - .setWidth(15.0) - .setImagePixelRatio(2.0) - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .build(); + PlatformBitmapAssetMap bitmap = + new PlatformBitmapAssetMap( + fakeAssetName, + PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ 15.0, + /* height */ null); BitmapDescriptor result = Convert.getBitmapFromAsset( @@ -182,13 +181,13 @@ public void GetBitmapFromAssetAutoAndHeight() throws Exception { when(assetManager.open(fakeAssetKey)).thenReturn(TestImageUtils.buildImageInputStream()); when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); - Messages.PlatformBitmapAssetMap bitmap = - new Messages.PlatformBitmapAssetMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .setHeight(15.0) - .setImagePixelRatio(2.0) - .setAssetName(fakeAssetName) - .build(); + PlatformBitmapAssetMap bitmap = + new PlatformBitmapAssetMap( + fakeAssetName, + PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ null, + /* height */ 15.0); BitmapDescriptor result = Convert.getBitmapFromAsset( @@ -209,12 +208,13 @@ public void GetBitmapFromAssetNoScaling() throws Exception { when(bitmapDescriptorFactoryWrapper.fromAsset(any())).thenReturn(mockBitmapDescriptor); verify(bitmapDescriptorFactoryWrapper, never()).fromBitmap(any()); - Messages.PlatformBitmapAssetMap bitmap = - new Messages.PlatformBitmapAssetMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.NONE) - .setImagePixelRatio(2.0) - .setAssetName(fakeAssetName) - .build(); + PlatformBitmapAssetMap bitmap = + new PlatformBitmapAssetMap( + fakeAssetName, + PlatformMapBitmapScaling.NONE, + /* imagePixelRatio */ 2.0, + /* width */ null, + /* height */ null); BitmapDescriptor result = Convert.getBitmapFromAsset( @@ -229,12 +229,13 @@ public void GetBitmapFromBytesAuto() { when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); - Messages.PlatformBitmapBytesMap bitmap = - new Messages.PlatformBitmapBytesMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .setImagePixelRatio(2.0) - .setByteData(bmpData) - .build(); + PlatformBitmapBytesMap bitmap = + new PlatformBitmapBytesMap( + bmpData, + PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ null, + /* height */ null); BitmapDescriptor result = Convert.getBitmapFromBytes(bitmap, 1f, bitmapDescriptorFactoryWrapper); @@ -247,13 +248,13 @@ public void GetBitmapFromBytesAutoAndWidth() { byte[] bmpData = Base64.decode(base64Image, Base64.DEFAULT); when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); - Messages.PlatformBitmapBytesMap bitmap = - new Messages.PlatformBitmapBytesMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .setImagePixelRatio(2.0) - .setByteData(bmpData) - .setWidth(15.0) - .build(); + PlatformBitmapBytesMap bitmap = + new PlatformBitmapBytesMap( + bmpData, + /* bitmapScaling */ PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ 15.0, + /* height */ null); BitmapDescriptor result = Convert.getBitmapFromBytes(bitmap, 1f, bitmapDescriptorFactoryWrapper); @@ -266,13 +267,13 @@ public void GetBitmapFromBytesAutoAndHeight() { byte[] bmpData = Base64.decode(base64Image, Base64.DEFAULT); when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); - Messages.PlatformBitmapBytesMap bitmap = - new Messages.PlatformBitmapBytesMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .setImagePixelRatio(2.0) - .setByteData(bmpData) - .setHeight(15.0) - .build(); + PlatformBitmapBytesMap bitmap = + new PlatformBitmapBytesMap( + bmpData, + /* bitmapScaling */ PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ null, + /* height */ 15.0); BitmapDescriptor result = Convert.getBitmapFromBytes(bitmap, 1f, bitmapDescriptorFactoryWrapper); @@ -285,12 +286,13 @@ public void GetBitmapFromBytesNoScaling() { byte[] bmpData = Base64.decode(base64Image, Base64.DEFAULT); when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); - Messages.PlatformBitmapBytesMap bitmap = - new Messages.PlatformBitmapBytesMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.NONE) - .setImagePixelRatio(2.0) - .setByteData(bmpData) - .build(); + PlatformBitmapBytesMap bitmap = + new PlatformBitmapBytesMap( + bmpData, + /* bitmapScaling */ PlatformMapBitmapScaling.NONE, + /* imagePixelRatio */ 2.0, + /* width */ null, + /* height */ null); BitmapDescriptor result = Convert.getBitmapFromBytes(bitmap, 1f, bitmapDescriptorFactoryWrapper); @@ -304,17 +306,18 @@ public void GetBitmapFromBytesThrowsErrorIfInvalidImageData() { byte[] bmpData = Base64.decode(invalidBase64Image, Base64.DEFAULT); verify(bitmapDescriptorFactoryWrapper, never()).fromBitmap(any()); - Messages.PlatformBitmapBytesMap bitmap = - new Messages.PlatformBitmapBytesMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.NONE) - .setImagePixelRatio(2.0) - .setByteData(bmpData) - .build(); + PlatformBitmapBytesMap bitmap = + new PlatformBitmapBytesMap( + bmpData, + /* bitmapScaling */ PlatformMapBitmapScaling.NONE, + /* imagePixelRatio */ 2.0, + /* width */ null, + /* height */ null); try { Convert.getBitmapFromBytes(bitmap, 1f, bitmapDescriptorFactoryWrapper); } catch (IllegalArgumentException e) { - Assert.assertEquals(e.getMessage(), "Unable to interpret bytes as a valid image."); + Assert.assertEquals("Unable to interpret bytes as a valid image.", e.getMessage()); throw e; // rethrow the exception } @@ -323,13 +326,14 @@ public void GetBitmapFromBytesThrowsErrorIfInvalidImageData() { @Test public void GetPinConfigFromPlatformPinConfig_GlyphColor() { - Messages.PlatformBitmapPinConfig platformBitmap = - new Messages.PlatformBitmapPinConfig.Builder() - .setBackgroundColor( - new Messages.PlatformColor.Builder().setArgbValue(0x00FFFFL).build()) - .setBorderColor(new Messages.PlatformColor.Builder().setArgbValue(0xFF00FFL).build()) - .setGlyphColor(new Messages.PlatformColor.Builder().setArgbValue(0x112233L).build()) - .build(); + PlatformBitmapPinConfig platformBitmap = + new PlatformBitmapPinConfig( + /* backgroundColor */ new PlatformColor(0x00FFFFL), + /* borderColor */ new PlatformColor(0xFF00FFL), + /* glyphColor */ new PlatformColor(0x112233L), + /* glyphBitmap */ null, + /* glyphText */ null, + /* glyphTextColor */ null); PinConfig pinConfig = getPinConfigFromPlatformPinConfig( @@ -341,11 +345,14 @@ public void GetPinConfigFromPlatformPinConfig_GlyphColor() { @Test public void GetPinConfigFromPlatformPinConfig_Glyph() { - Messages.PlatformBitmapPinConfig platformBitmap = - new Messages.PlatformBitmapPinConfig.Builder() - .setGlyphText("Hi") - .setGlyphTextColor(new Messages.PlatformColor.Builder().setArgbValue(0xFFFFFFL).build()) - .build(); + PlatformBitmapPinConfig platformBitmap = + new PlatformBitmapPinConfig( + /* backgroundColor */ null, + /* borderColor */ null, + /* glyphColor */ null, + /* glyphBitmap */ null, + /* glyphText */ "Hi", + /* glyphTextColor */ new PlatformColor(0xFFFFFFL)); PinConfig pinConfig = getPinConfigFromPlatformPinConfig( platformBitmap, assetManager, 1, bitmapDescriptorFactoryWrapper); @@ -356,21 +363,22 @@ public void GetPinConfigFromPlatformPinConfig_Glyph() { @Test public void GetPinConfigFromPlatformPinConfig_GlyphBitmap() { byte[] bmpData = Base64.decode(base64Image, Base64.DEFAULT); - Messages.PlatformBitmapBytesMap bytesBitmap = - new Messages.PlatformBitmapBytesMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .setImagePixelRatio(2.0) - .setByteData(bmpData) - .build(); - Messages.PlatformBitmap icon = - new Messages.PlatformBitmap.Builder().setBitmap(bytesBitmap).build(); - Messages.PlatformBitmapPinConfig platformBitmap = - new Messages.PlatformBitmapPinConfig.Builder() - .setBackgroundColor( - new Messages.PlatformColor.Builder().setArgbValue(0xFFFFFFL).build()) - .setBorderColor(new Messages.PlatformColor.Builder().setArgbValue(0x000000L).build()) - .setGlyphBitmap(icon) - .build(); + PlatformBitmapBytesMap bytesBitmap = + new PlatformBitmapBytesMap( + bmpData, + /* bitmapScaling */ PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ null, + /* height */ null); + PlatformBitmap icon = new PlatformBitmap(bytesBitmap); + PlatformBitmapPinConfig platformBitmap = + new PlatformBitmapPinConfig( + /* backgroundColor */ new PlatformColor(0xFFFFFFL), + /* borderColor */ new PlatformColor(0x000000L), + /* glyphColor */ null, + /* glyphBitmap */ icon, + /* glyphText */ null, + /* glyphTextColor */ null); when(bitmapDescriptorFactoryWrapper.fromBitmap(any())).thenReturn(mockBitmapDescriptor); PinConfig pinConfig = getPinConfigFromPlatformPinConfig( @@ -382,20 +390,20 @@ public void GetPinConfigFromPlatformPinConfig_GlyphBitmap() { } /// Returns a PlatformMapConfiguration.Builder that sets required parameters. - private Messages.PlatformMapConfiguration.Builder getMinimalConfigurationBuilder() { - return new Messages.PlatformMapConfiguration.Builder().setMarkerType(PlatformMarkerType.MARKER); + private PlatformMapConfigurationBuilder getMinimalConfigurationBuilder() { + return new PlatformMapConfigurationBuilder().setMarkerType(PlatformMarkerType.MARKER); } @Test public void interpretMapConfiguration_handlesNulls() { - final Messages.PlatformMapConfiguration config = getMinimalConfigurationBuilder().build(); + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().build(); Convert.interpretMapConfiguration(config, optionsSink); verifyNoInteractions(optionsSink); } @Test public void interpretMapConfiguration_handlesCompassEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setCompassEnabled(false).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setCompassEnabled(false); @@ -403,7 +411,7 @@ public void interpretMapConfiguration_handlesCompassEnabled() { @Test public void interpretMapConfiguration_handlesMapToolbarEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setMapToolbarEnabled(true).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setMapToolbarEnabled(true); @@ -411,7 +419,7 @@ public void interpretMapConfiguration_handlesMapToolbarEnabled() { @Test public void interpretMapConfiguration_handlesRotateGesturesEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setRotateGesturesEnabled(false).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setRotateGesturesEnabled(false); @@ -419,7 +427,7 @@ public void interpretMapConfiguration_handlesRotateGesturesEnabled() { @Test public void interpretMapConfiguration_handlesScrollGesturesEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setScrollGesturesEnabled(true).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setScrollGesturesEnabled(true); @@ -427,7 +435,7 @@ public void interpretMapConfiguration_handlesScrollGesturesEnabled() { @Test public void interpretMapConfiguration_handlesTiltGesturesEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setTiltGesturesEnabled(false).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setTiltGesturesEnabled(false); @@ -435,7 +443,7 @@ public void interpretMapConfiguration_handlesTiltGesturesEnabled() { @Test public void interpretMapConfiguration_handlesTrackCameraPosition() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setTrackCameraPosition(true).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setTrackCameraPosition(true); @@ -443,7 +451,7 @@ public void interpretMapConfiguration_handlesTrackCameraPosition() { @Test public void interpretMapConfiguration_handlesZoomControlsEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setZoomControlsEnabled(false).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setZoomControlsEnabled(false); @@ -451,7 +459,7 @@ public void interpretMapConfiguration_handlesZoomControlsEnabled() { @Test public void interpretMapConfiguration_handlesZoomGesturesEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setZoomGesturesEnabled(true).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setZoomGesturesEnabled(true); @@ -459,7 +467,7 @@ public void interpretMapConfiguration_handlesZoomGesturesEnabled() { @Test public void interpretMapConfiguration_handlesMyLocationEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setMyLocationEnabled(false).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setMyLocationEnabled(false); @@ -467,7 +475,7 @@ public void interpretMapConfiguration_handlesMyLocationEnabled() { @Test public void interpretMapConfiguration_handlesMyLocationButtonEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setMyLocationButtonEnabled(true).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setMyLocationButtonEnabled(true); @@ -475,7 +483,7 @@ public void interpretMapConfiguration_handlesMyLocationButtonEnabled() { @Test public void interpretMapConfiguration_handlesIndoorViewEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setIndoorViewEnabled(false).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setIndoorEnabled(false); @@ -483,7 +491,7 @@ public void interpretMapConfiguration_handlesIndoorViewEnabled() { @Test public void interpretMapConfiguration_handlesTrafficEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setTrafficEnabled(true).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setTrafficEnabled(true); @@ -491,7 +499,7 @@ public void interpretMapConfiguration_handlesTrafficEnabled() { @Test public void interpretMapConfiguration_handlesBuildingsEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setBuildingsEnabled(false).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setBuildingsEnabled(false); @@ -499,7 +507,7 @@ public void interpretMapConfiguration_handlesBuildingsEnabled() { @Test public void interpretMapConfiguration_handlesLiteModeEnabled() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setLiteModeEnabled(true).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setLiteModeEnabled(true); @@ -507,7 +515,7 @@ public void interpretMapConfiguration_handlesLiteModeEnabled() { @Test public void interpretMapConfiguration_handlesStyle() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder().setStyle("foo").build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setMapStyle("foo"); @@ -515,9 +523,9 @@ public void interpretMapConfiguration_handlesStyle() { @Test public void interpretMapConfiguration_handlesUnboundedCameraTargetBounds() { - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder() - .setCameraTargetBounds(new Messages.PlatformCameraTargetBounds.Builder().build()) + .setCameraTargetBounds(new PlatformCameraTargetBounds(null)) .build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setCameraTargetBounds(null); @@ -526,24 +534,13 @@ public void interpretMapConfiguration_handlesUnboundedCameraTargetBounds() { @Test public void interpretMapConfiguration_handlesBoundedCameraTargetBounds() { LatLngBounds bounds = new LatLngBounds(new LatLng(10, 20), new LatLng(30, 40)); - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder() .setCameraTargetBounds( - new Messages.PlatformCameraTargetBounds.Builder() - .setBounds( - new Messages.PlatformLatLngBounds.Builder() - .setSouthwest( - new Messages.PlatformLatLng.Builder() - .setLatitude(bounds.southwest.latitude) - .setLongitude(bounds.southwest.longitude) - .build()) - .setNortheast( - new Messages.PlatformLatLng.Builder() - .setLatitude(bounds.northeast.latitude) - .setLongitude(bounds.northeast.longitude) - .build()) - .build()) - .build()) + new PlatformCameraTargetBounds( + new PlatformLatLngBounds( + new PlatformLatLng(bounds.northeast.latitude, bounds.northeast.longitude), + new PlatformLatLng(bounds.southwest.latitude, bounds.southwest.longitude)))) .build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setCameraTargetBounds(bounds); @@ -551,8 +548,8 @@ public void interpretMapConfiguration_handlesBoundedCameraTargetBounds() { @Test public void interpretMapConfiguration_handlesMapType() { - final Messages.PlatformMapConfiguration config = - getMinimalConfigurationBuilder().setMapType(Messages.PlatformMapType.HYBRID).build(); + final PlatformMapConfiguration config = + getMinimalConfigurationBuilder().setMapType(PlatformMapType.HYBRID).build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setMapType(MAP_TYPE_HYBRID); } @@ -563,15 +560,11 @@ public void interpretMapConfiguration_handlesPadding() { final double bottom = 2.0; final double left = 3.0; final double right = 4.0; - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder() .setPadding( - new Messages.PlatformEdgeInsets.Builder() - .setTop(top) - .setBottom(bottom) - .setLeft(left) - .setRight(right) - .build()) + new PlatformEdgeInsets( + /* top= */ top, /* bottom= */ bottom, /* left= */ left, /* right= */ right)) .build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)) @@ -582,10 +575,9 @@ public void interpretMapConfiguration_handlesPadding() { public void interpretMapConfiguration_handlesMinMaxZoomPreference() { final double min = 1.0; final double max = 2.0; - final Messages.PlatformMapConfiguration config = + final PlatformMapConfiguration config = getMinimalConfigurationBuilder() - .setMinMaxZoomPreference( - new Messages.PlatformZoomRange.Builder().setMin(min).setMax(max).build()) + .setMinMaxZoomPreference(new PlatformZoomRange(min, max)) .build(); Convert.interpretMapConfiguration(config, optionsSink); verify(optionsSink, times(1)).setMinMaxZoomPreference((float) min, (float) max); @@ -596,12 +588,8 @@ public void interpretMapConfiguration_handlesMinMaxZoomPreference() { @Test() public void ConvertToWeightedLatLngReturnsCorrectData() { final double intensity = 3.3; - final Messages.PlatformWeightedLatLng data = - new Messages.PlatformWeightedLatLng.Builder() - .setPoint( - new Messages.PlatformLatLng.Builder().setLatitude(1.1).setLongitude(2.2).build()) - .setWeight(intensity) - .build(); + final PlatformWeightedLatLng data = + new PlatformWeightedLatLng(new PlatformLatLng(1.1, 2.2), intensity); final Point point = sProjection.toPoint(new LatLng(1.1, 2.2)); final WeightedLatLng result = Convert.weightedLatLngFromPigeon(data); @@ -614,16 +602,8 @@ public void ConvertToWeightedLatLngReturnsCorrectData() { @Test() public void ConvertToWeightedDataReturnsCorrectData() { final double intensity = 3.3; - final List data = - List.of( - new Messages.PlatformWeightedLatLng.Builder() - .setPoint( - new Messages.PlatformLatLng.Builder() - .setLatitude(1.1) - .setLongitude(2.2) - .build()) - .setWeight(intensity) - .build()); + final List data = + List.of(new PlatformWeightedLatLng(new PlatformLatLng(1.1, 2.2), intensity)); final Point point = sProjection.toPoint(new LatLng(1.1, 2.2)); final List result = Convert.weightedDataFromPigeon(data); @@ -639,7 +619,7 @@ public void ConvertToGradientReturnsCorrectData() { final long color1 = 0; final long color2 = 1; final long color3 = 2; - final List colorData = + final List colorData = List.of( createPlatformColor(color1), createPlatformColor(color2), createPlatformColor(color3)); final double startPoint1 = 0.0; @@ -647,12 +627,8 @@ public void ConvertToGradientReturnsCorrectData() { final double startPoint3 = 2.0; List startPointData = List.of(startPoint1, startPoint2, startPoint3); final long colorMapSize = 3; - final Messages.PlatformHeatmapGradient data = - new Messages.PlatformHeatmapGradient.Builder() - .setColors(colorData) - .setStartPoints(startPointData) - .setColorMapSize(colorMapSize) - .build(); + final PlatformHeatmapGradient data = + new PlatformHeatmapGradient(colorData, startPointData, colorMapSize); final Gradient result = Convert.gradientFromPigeon(data); @@ -670,22 +646,14 @@ public void ConvertToGradientReturnsCorrectData() { @Test() public void ConvertInterpretHeatmapOptionsReturnsCorrectData() { final double intensity = 3.3; - final List dataData = - List.of( - new Messages.PlatformWeightedLatLng.Builder() - .setPoint( - new Messages.PlatformLatLng.Builder() - .setLatitude(1.1) - .setLongitude(2.2) - .build()) - .setWeight(intensity) - .build()); + final List dataData = + List.of(new PlatformWeightedLatLng(new PlatformLatLng(1.1, 2.2), intensity)); final Point point = sProjection.toPoint(new LatLng(1.1, 2.2)); final long color1 = 0; final long color2 = 1; final long color3 = 2; - final List colorData = + final List colorData = List.of( createPlatformColor(color1), createPlatformColor(color2), createPlatformColor(color3)); final double startPoint1 = 0.0; @@ -693,27 +661,22 @@ public void ConvertInterpretHeatmapOptionsReturnsCorrectData() { final double startPoint3 = 2.0; List startPointData = List.of(startPoint1, startPoint2, startPoint3); final long colorMapSize = 3; - final Messages.PlatformHeatmapGradient gradientData = - new Messages.PlatformHeatmapGradient.Builder() - .setColors(colorData) - .setStartPoints(startPointData) - .setColorMapSize(colorMapSize) - .build(); + final PlatformHeatmapGradient gradientData = + new PlatformHeatmapGradient(colorData, startPointData, colorMapSize); final double maxIntensity = 4.0; final double opacity = 5.5; final long radius = 6; final String idData = "heatmap_1"; - final Messages.PlatformHeatmap data = - new Messages.PlatformHeatmap.Builder() - .setData(dataData) - .setGradient(gradientData) - .setMaxIntensity(maxIntensity) - .setOpacity(opacity) - .setRadius(radius) - .setHeatmapId(idData) - .build(); + final PlatformHeatmap data = + new PlatformHeatmap( + idData, + dataData, + gradientData, + /* opacity */ opacity, + /* radius */ radius, + /* maxIntensity */ maxIntensity); final MockHeatmapBuilder builder = new MockHeatmapBuilder(); final String id = Convert.interpretHeatmapOptions(data, builder); @@ -737,8 +700,8 @@ public void ConvertInterpretHeatmapOptionsReturnsCorrectData() { Assert.assertEquals(idData, id); } - private Messages.PlatformColor createPlatformColor(long rgba) { - return new Messages.PlatformColor.Builder().setArgbValue(rgba).build(); + private PlatformColor createPlatformColor(long rgba) { + return new PlatformColor(rgba); } @Test @@ -751,7 +714,7 @@ public void buildGroundOverlayAnchorForPigeonWithNonCrossingMeridian() { when(groundOverlay.getPosition()).thenReturn(position); when(groundOverlay.getBounds()).thenReturn(bounds); - Messages.PlatformDoublePair anchor = Convert.buildGroundOverlayAnchorForPigeon(groundOverlay); + PlatformDoublePair anchor = Convert.buildGroundOverlayAnchorForPigeon(groundOverlay); Assert.assertEquals(0.5, anchor.getX(), 1e-15); Assert.assertEquals(0.5, anchor.getY(), 1e-15); @@ -767,14 +730,14 @@ public void buildGroundOverlayAnchorForPigeonWithCrossingMeridian() { when(groundOverlay.getPosition()).thenReturn(position); when(groundOverlay.getBounds()).thenReturn(bounds); - Messages.PlatformDoublePair anchor = Convert.buildGroundOverlayAnchorForPigeon(groundOverlay); + PlatformDoublePair anchor = Convert.buildGroundOverlayAnchorForPigeon(groundOverlay); Assert.assertEquals(0.5, anchor.getX(), 1e-15); Assert.assertEquals(0.5, anchor.getY(), 1e-15); } private void assertGroundOverlayEquals( - Messages.PlatformGroundOverlay result, + PlatformGroundOverlay result, GroundOverlay expectedOverlay, String expectedId, LatLng expectedPosition, @@ -815,10 +778,10 @@ private void assertGroundOverlayEquals( Assert.assertEquals(expectedOverlay.getBearing(), result.getBearing(), 1e-15); Assert.assertEquals(expectedOverlay.getTransparency(), result.getTransparency(), 1e-6); - Assert.assertEquals(expectedOverlay.getZIndex(), result.getZIndex().intValue(), 1e-6); + Assert.assertEquals(expectedOverlay.getZIndex(), result.getZIndex(), 1e-6); Assert.assertEquals(expectedOverlay.isVisible(), result.getVisible()); Assert.assertEquals(expectedOverlay.isClickable(), result.getClickable()); - Messages.PlatformDoublePair anchor = result.getAnchor(); + PlatformDoublePair anchor = result.getAnchor(); Assert.assertNotNull(anchor); Assert.assertEquals(0.5, anchor.getX(), 1e-6); Assert.assertEquals(0.5, anchor.getY(), 1e-6); @@ -842,7 +805,7 @@ public void groundOverlayToPigeonWithPosition() { when(mockGroundOverlay.isClickable()).thenReturn(false); String overlayId = "overlay_1"; - Messages.PlatformGroundOverlay result = + PlatformGroundOverlay result = Convert.groundOverlayToPigeon(mockGroundOverlay, overlayId, false); assertGroundOverlayEquals(result, mockGroundOverlay, overlayId, position, null); @@ -866,11 +829,184 @@ public void groundOverlayToPigeonWithBounds() { when(mockGroundOverlay.isClickable()).thenReturn(false); String overlayId = "overlay_2"; - Messages.PlatformGroundOverlay result = + PlatformGroundOverlay result = Convert.groundOverlayToPigeon(mockGroundOverlay, overlayId, true); assertGroundOverlayEquals(result, mockGroundOverlay, overlayId, null, bounds); } + + // Remove this if builders are added to the Kotlin generator; see discussion in + // https://github.com/flutter/flutter/issues/158287 + private static final class PlatformMapConfigurationBuilder { + private @Nullable Boolean compassEnabled; + private @Nullable PlatformCameraTargetBounds cameraTargetBounds; + private @Nullable PlatformMapType mapType; + private @Nullable PlatformZoomRange minMaxZoomPreference; + private @Nullable Boolean mapToolbarEnabled; + private @Nullable Boolean rotateGesturesEnabled; + private @Nullable Boolean scrollGesturesEnabled; + private @Nullable Boolean tiltGesturesEnabled; + private @Nullable Boolean trackCameraPosition; + private @Nullable Boolean zoomControlsEnabled; + private @Nullable Boolean zoomGesturesEnabled; + private @Nullable Boolean myLocationEnabled; + private @Nullable Boolean myLocationButtonEnabled; + private @Nullable PlatformEdgeInsets padding; + private @Nullable Boolean indoorViewEnabled; + private @Nullable Boolean trafficEnabled; + private @Nullable Boolean buildingsEnabled; + private @Nullable Boolean liteModeEnabled; + private @Nullable PlatformMarkerType markerType; + private @Nullable String mapId; + private @Nullable String style; + + public @NonNull PlatformMapConfigurationBuilder setCompassEnabled(@Nullable Boolean setterArg) { + this.compassEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setCameraTargetBounds( + @Nullable PlatformCameraTargetBounds setterArg) { + this.cameraTargetBounds = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setMapType( + @Nullable PlatformMapType setterArg) { + this.mapType = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setMinMaxZoomPreference( + @Nullable PlatformZoomRange setterArg) { + this.minMaxZoomPreference = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setMapToolbarEnabled( + @Nullable Boolean setterArg) { + this.mapToolbarEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setRotateGesturesEnabled( + @Nullable Boolean setterArg) { + this.rotateGesturesEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setScrollGesturesEnabled( + @Nullable Boolean setterArg) { + this.scrollGesturesEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setTiltGesturesEnabled( + @Nullable Boolean setterArg) { + this.tiltGesturesEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setTrackCameraPosition( + @Nullable Boolean setterArg) { + this.trackCameraPosition = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setZoomControlsEnabled( + @Nullable Boolean setterArg) { + this.zoomControlsEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setZoomGesturesEnabled( + @Nullable Boolean setterArg) { + this.zoomGesturesEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setMyLocationEnabled( + @Nullable Boolean setterArg) { + this.myLocationEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setMyLocationButtonEnabled( + @Nullable Boolean setterArg) { + this.myLocationButtonEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setPadding( + @Nullable PlatformEdgeInsets setterArg) { + this.padding = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setIndoorViewEnabled( + @Nullable Boolean setterArg) { + this.indoorViewEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setTrafficEnabled(@Nullable Boolean setterArg) { + this.trafficEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setBuildingsEnabled( + @Nullable Boolean setterArg) { + this.buildingsEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setLiteModeEnabled( + @Nullable Boolean setterArg) { + this.liteModeEnabled = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setMarkerType( + @NonNull PlatformMarkerType setterArg) { + this.markerType = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setMapId(@Nullable String setterArg) { + this.mapId = setterArg; + return this; + } + + public @NonNull PlatformMapConfigurationBuilder setStyle(@Nullable String setterArg) { + this.style = setterArg; + return this; + } + + public @NonNull PlatformMapConfiguration build() { + return new PlatformMapConfiguration( + compassEnabled, + cameraTargetBounds, + mapType, + minMaxZoomPreference, + mapToolbarEnabled, + rotateGesturesEnabled, + scrollGesturesEnabled, + tiltGesturesEnabled, + trackCameraPosition, + zoomControlsEnabled, + zoomGesturesEnabled, + myLocationEnabled, + myLocationButtonEnabled, + padding, + indoorViewEnabled, + trafficEnabled, + buildingsEnabled, + liteModeEnabled, + Objects.requireNonNull(markerType), + mapId, + style); + } + } } class MockHeatmapBuilder implements HeatmapOptionsSink { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java index d063cb17317a..38c95e18f3f3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java @@ -29,7 +29,6 @@ import com.google.android.gms.maps.model.Marker; import com.google.maps.android.clustering.ClusterManager; import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.util.ArrayList; import java.util.List; import org.junit.After; @@ -52,7 +51,7 @@ public class GoogleMapControllerTest { AutoCloseable mockCloseable; @Mock BinaryMessenger mockMessenger; @Mock GoogleMap mockGoogleMap; - @Mock Messages.MapsCallbackApi flutterApi; + @Mock MapsCallbackApi flutterApi; @Mock ClusterManagersController mockClusterManagersController; @Mock MarkersController mockMarkersController; @Mock PolygonsController mockPolygonsController; @@ -221,14 +220,14 @@ public void OnMapReadySetsClusterItemRenderedListener() { @Test public void SetInitialClusterManagers() { GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies(); - Messages.PlatformClusterManager initialClusterManager = - new Messages.PlatformClusterManager.Builder().setIdentifier("cm_1").build(); - List initialClusterManagers = new ArrayList<>(); + PlatformClusterManager initialClusterManager = new PlatformClusterManager("cm_1"); + List initialClusterManagers = new ArrayList<>(); initialClusterManagers.add(initialClusterManager); googleMapController.setInitialClusterManagers(initialClusterManagers); googleMapController.onMapReady(mockGoogleMap); - // Verify if the ClusterManagersController.addClusterManagers method is called with initial cluster managers. + // Verify if the ClusterManagersController.addClusterManagers method is called with initial + // cluster managers. verify(mockClusterManagersController, times(1)).addClusterManagers(any()); } @@ -263,7 +262,7 @@ public void OnClusterItemInfoWindowClickCallsMarkersController() { public void SetInitialHeatmaps() { GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies(); - List initialHeatmaps = List.of(new Messages.PlatformHeatmap()); + List initialHeatmaps = List.of(createHeatmap("hm_1")); googleMapController.setInitialHeatmaps(initialHeatmaps); googleMapController.onMapReady(mockGoogleMap); @@ -275,8 +274,8 @@ public void SetInitialHeatmaps() { public void UpdateHeatmaps() { GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies(); - final List toAdd = List.of(new Messages.PlatformHeatmap()); - final List toChange = List.of(new Messages.PlatformHeatmap()); + final List toAdd = List.of(createHeatmap("hm_add")); + final List toChange = List.of(createHeatmap("hm_change")); final List idsToRemove = List.of("hm_1"); googleMapController.updateHeatmaps(toAdd, toChange, idsToRemove); @@ -291,10 +290,8 @@ public void AnimateCamera() { GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies(); googleMapController.onMapReady(mockGoogleMap); - Messages.PlatformCameraUpdateZoomBy newCameraPosition = - new Messages.PlatformCameraUpdateZoomBy.Builder().setAmount(1.0).build(); - Messages.PlatformCameraUpdate cameraUpdate = - new Messages.PlatformCameraUpdate.Builder().setCameraUpdate(newCameraPosition).build(); + PlatformCameraUpdateZoomBy newCameraPosition = new PlatformCameraUpdateZoomBy(1.0, null); + PlatformCameraUpdate cameraUpdate = new PlatformCameraUpdate(newCameraPosition); try (MockedStatic mockedFactory = mockStatic(CameraUpdateFactory.class)) { mockedFactory @@ -311,10 +308,8 @@ public void AnimateCameraWithDuration() { GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies(); googleMapController.onMapReady(mockGoogleMap); - Messages.PlatformCameraUpdateZoomBy newCameraPosition = - new Messages.PlatformCameraUpdateZoomBy.Builder().setAmount(1.0).build(); - Messages.PlatformCameraUpdate cameraUpdate = - new Messages.PlatformCameraUpdate.Builder().setCameraUpdate(newCameraPosition).build(); + PlatformCameraUpdateZoomBy newCameraPosition = new PlatformCameraUpdateZoomBy(1.0, null); + PlatformCameraUpdate cameraUpdate = new PlatformCameraUpdate(newCameraPosition); Long durationMilliseconds = 1000L; @@ -337,7 +332,7 @@ public void getCameraPositionReturnsCorrectData() { CameraPosition cameraPosition = new CameraPosition(new LatLng(10.0, 20.0), 15.0f, 30.0f, 45.0f); when(mockGoogleMap.getCameraPosition()).thenReturn(cameraPosition); - Messages.PlatformCameraPosition result = googleMapController.getCameraPosition(); + PlatformCameraPosition result = googleMapController.getCameraPosition(); Assert.assertEquals(cameraPosition.target.latitude, result.getTarget().getLatitude(), 1e-15); Assert.assertEquals(cameraPosition.target.longitude, result.getTarget().getLongitude(), 1e-15); @@ -353,9 +348,15 @@ public void isAdvancedMarkersAvailableReturnsCorrectData() { when(mockGoogleMap.getMapCapabilities()).thenReturn(mapCapabilities); when(mapCapabilities.isAdvancedMarkersAvailable()).thenReturn(true); - Assert.assertEquals(true, googleMapController.isAdvancedMarkersAvailable()); + Assert.assertTrue(googleMapController.isAdvancedMarkersAvailable()); when(mapCapabilities.isAdvancedMarkersAvailable()).thenReturn(false); - Assert.assertEquals(false, googleMapController.isAdvancedMarkersAvailable()); + Assert.assertFalse(googleMapController.isAdvancedMarkersAvailable()); + } + + private PlatformHeatmap createHeatmap(String id) { + final List heatmapData = + List.of(new PlatformWeightedLatLng(new PlatformLatLng(1.1, 2.2), 3.3)); + return new PlatformHeatmap(id, heatmapData, null, /* opacity */ 1.0, /* radius */ 20, null); } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java index 3a84b48fe5f4..3e72825b1993 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapInitializerTest.java @@ -4,18 +4,17 @@ package io.flutter.plugins.googlemaps; -import static org.mockito.Mockito.any; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; import android.content.Context; import androidx.test.core.app.ApplicationProvider; import com.google.android.gms.maps.MapsInitializer.Renderer; import io.flutter.plugin.common.BinaryMessenger; +import kotlin.Unit; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -39,34 +38,55 @@ public void before() { @Test public void initializer_OnMapsSdkInitializedWithLatestRenderer() { doNothing().when(googleMapInitializer).initializeWithRendererRequest(Renderer.LATEST); - @SuppressWarnings("unchecked") - Messages.Result result = mock(Messages.Result.class); + final Boolean[] callbackCalled = new Boolean[1]; googleMapInitializer.initializeWithPreferredRenderer( - Messages.PlatformRendererType.LATEST, result); + PlatformRendererType.LATEST, + ResultCompat.asCompatCallback( + result -> { + callbackCalled[0] = true; + PlatformRendererType type = result.getOrNull(); + assertEquals(PlatformRendererType.LATEST, type); + return Unit.INSTANCE; + })); googleMapInitializer.onMapsSdkInitialized(Renderer.LATEST); - verify(result, times(1)).success(Messages.PlatformRendererType.LATEST); - verify(result, never()).error(any()); + + assertTrue(callbackCalled[0]); } @SuppressWarnings("deprecation") @Test public void initializer_OnMapsSdkInitializedWithLegacyRenderer() { doNothing().when(googleMapInitializer).initializeWithRendererRequest(Renderer.LEGACY); - @SuppressWarnings("unchecked") - Messages.Result result = mock(Messages.Result.class); + final Boolean[] callbackCalled = new Boolean[1]; googleMapInitializer.initializeWithPreferredRenderer( - Messages.PlatformRendererType.LEGACY, result); + PlatformRendererType.LEGACY, + ResultCompat.asCompatCallback( + result -> { + callbackCalled[0] = true; + PlatformRendererType type = result.getOrNull(); + assertEquals(PlatformRendererType.LEGACY, type); + return Unit.INSTANCE; + })); googleMapInitializer.onMapsSdkInitialized(Renderer.LEGACY); - verify(result, times(1)).success(Messages.PlatformRendererType.LEGACY); - verify(result, never()).error(any()); + + assertTrue(callbackCalled[0]); } @Test public void initializer_onMethodCallWithNoRendererPreference() { doNothing().when(googleMapInitializer).initializeWithRendererRequest(null); - @SuppressWarnings("unchecked") - Messages.Result result = mock(Messages.Result.class); - googleMapInitializer.initializeWithPreferredRenderer(null, result); - verify(result, never()).error(any()); + final Boolean[] callbackCalled = new Boolean[1]; + googleMapInitializer.initializeWithPreferredRenderer( + null, + ResultCompat.asCompatCallback( + result -> { + callbackCalled[0] = true; + Throwable error = result.exceptionOrNull(); + assertNull(error); + return Unit.INSTANCE; + })); + googleMapInitializer.onMapsSdkInitialized(Renderer.LATEST); + + assertTrue(callbackCalled[0]); } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java index 92776368e9f4..76d7b36a1859 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GroundOverlaysControllerTest.java @@ -45,25 +45,28 @@ public class GroundOverlaysControllerTest { private final String base64Image = TestImageUtils.generateBase64Image(); @NonNull - private Messages.PlatformGroundOverlay.Builder defaultGroundOverlayBuilder() { + private PlatformGroundOverlay createGroundOverlay(String overlayId, double transparency) { byte[] bmpData = Base64.decode(base64Image, Base64.DEFAULT); - return new Messages.PlatformGroundOverlay.Builder() - .setImage( - new Messages.PlatformBitmap.Builder() - .setBitmap( - new Messages.PlatformBitmapBytesMap.Builder() - .setBitmapScaling(Messages.PlatformMapBitmapScaling.AUTO) - .setImagePixelRatio(2.0) - .setByteData(bmpData) - .setWidth(100.0) - .build()) - .build()) - .setBearing(1.0) - .setZIndex(1L) - .setVisible(true) - .setTransparency(1.0) - .setClickable(true); + return new PlatformGroundOverlay( + overlayId, + new PlatformBitmap( + new PlatformBitmapBytesMap( + bmpData, + PlatformMapBitmapScaling.AUTO, + /* imagePixelRatio */ 2.0, + /* width */ 100.0, /* height */ + null)), + /* position */ null, + /* bounds */ null, + /* width */ null, + /* height */ null, + /* anchor */ null, + transparency, + /* bearing */ 1.0, + /* zIndex */ 1L, + /* visible */ true, + /* clickable */ true); } @Before @@ -71,8 +74,7 @@ public void setUp() { mockCloseable = MockitoAnnotations.openMocks(this); Context context = ApplicationProvider.getApplicationContext(); AssetManager assetManager = context.getAssets(); - Messages.MapsCallbackApi flutterApi = - spy(new Messages.MapsCallbackApi(mock(BinaryMessenger.class))); + MapsCallbackApi flutterApi = spy(new MapsCallbackApi(mock(BinaryMessenger.class), "")); controller = spy( new GroundOverlaysController( @@ -97,21 +99,13 @@ public void controller_AddChangeAndRemoveGroundOverlay() { when(googleMap.addGroundOverlay(any(GroundOverlayOptions.class))).thenReturn(groundOverlay); controller.addGroundOverlays( - Collections.singletonList( - defaultGroundOverlayBuilder() - .setGroundOverlayId(googleGroundOverlayId) - .setTransparency((double) transparency) - .build())); + Collections.singletonList(createGroundOverlay(googleGroundOverlayId, transparency))); Mockito.verify(googleMap, times(1)) .addGroundOverlay(Mockito.argThat(argument -> argument.getTransparency() == transparency)); final float newTransparency = 0.2f; controller.changeGroundOverlays( - Collections.singletonList( - defaultGroundOverlayBuilder() - .setGroundOverlayId(googleGroundOverlayId) - .setTransparency((double) newTransparency) - .build())); + Collections.singletonList(createGroundOverlay(googleGroundOverlayId, newTransparency))); Mockito.verify(groundOverlay, times(1)).setTransparency(newTransparency); controller.removeGroundOverlays(Collections.singletonList(googleGroundOverlayId)); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java index c97293b2c13a..09f14eee2c69 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/HeatmapsControllerTest.java @@ -41,31 +41,24 @@ public void controller_AddChangeAndRemoveHeatmap() { final HeatmapTileProvider heatmap = mock(HeatmapTileProvider.class); final String googleHeatmapId = "abc123"; - final List heatmapData = - List.of( - new Messages.PlatformWeightedLatLng.Builder() - .setPoint( - new Messages.PlatformLatLng.Builder() - .setLatitude(1.1) - .setLongitude(2.2) - .build()) - .setWeight(3.3) - .build()); + final List heatmapData = + List.of(new PlatformWeightedLatLng(new PlatformLatLng(1.1, 2.2), 3.3)); final long radius = 20; when(googleMap.addTileOverlay(any(TileOverlayOptions.class))).thenReturn(tileOverlay); doReturn(heatmap).when(controller).buildHeatmap(any(HeatmapBuilder.class)); final double opacity1 = 0.1f; - final Messages.PlatformHeatmap heatmapOptions1 = - new Messages.PlatformHeatmap.Builder() - .setHeatmapId(googleHeatmapId) - .setData(heatmapData) - .setOpacity(opacity1) - .setRadius(radius) - .build(); - - final List heatmaps = Collections.singletonList(heatmapOptions1); + final PlatformHeatmap heatmap1 = + new PlatformHeatmap( + googleHeatmapId, + heatmapData, + /* gradient */ null, + opacity1, + radius, + /* maxIntensity */ null); + + final List heatmaps = Collections.singletonList(heatmap1); controller.addHeatmaps(heatmaps); Mockito.verify(googleMap, times(1)) @@ -73,16 +66,16 @@ public void controller_AddChangeAndRemoveHeatmap() { Mockito.argThat(argument -> argument.getTileProvider() instanceof HeatmapTileProvider)); final double opacity2 = 0.2f; - final Messages.PlatformHeatmap heatmapOptions2 = - new Messages.PlatformHeatmap.Builder() - .setHeatmapId(googleHeatmapId) - .setData(heatmapData) - .setOpacity(opacity2) - .setRadius(radius) - .build(); - - final List heatmapUpdates = - Collections.singletonList(heatmapOptions2); + final PlatformHeatmap heatmap2 = + new PlatformHeatmap( + googleHeatmapId, + heatmapData, + /* gradient */ null, + opacity2, + radius, + /* maxIntensity */ null); + + final List heatmapUpdates = Collections.singletonList(heatmap2); controller.changeHeatmaps(heatmapUpdates); Mockito.verify(heatmap, times(1)).setOpacity(opacity2); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java index aba30f67ed02..d90c1966a443 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java @@ -15,6 +15,8 @@ import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.test.core.app.ApplicationProvider; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.AdvancedMarkerOptions; @@ -24,13 +26,11 @@ import com.google.android.gms.maps.model.MarkerOptions; import com.google.maps.android.collections.MarkerManager; import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugins.googlemaps.Messages.MapsCallbackApi; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerCollisionBehavior; -import io.flutter.plugins.googlemaps.Messages.PlatformMarkerType; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -57,28 +57,20 @@ public class MarkersControllerTest { @Mock private Convert.BitmapDescriptorFactoryWrapper bitmapDescriptorFactoryWrapper; - private static Messages.PlatformMarker.Builder defaultMarkerBuilder() { + private static PlatformMarkerBuilder defaultMarkerBuilder() { Bitmap fakeBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); fakeBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); - Messages.PlatformBitmap icon = - new Messages.PlatformBitmap.Builder() - .setBitmap( - new Messages.PlatformBitmapBytesMap.Builder() - .setByteData(byteArray) - .setImagePixelRatio(1.0) - .setBitmapScaling(Messages.PlatformMapBitmapScaling.NONE) - .build()) - .build(); - Messages.PlatformDoublePair anchor = - new Messages.PlatformDoublePair.Builder().setX(0.5).setY(0.0).build(); - Messages.PlatformInfoWindow infoWindow = - new Messages.PlatformInfoWindow.Builder().setAnchor(anchor).build(); - return new Messages.PlatformMarker.Builder() - .setPosition( - new Messages.PlatformLatLng.Builder().setLatitude(0.0).setLongitude(0.0).build()) - .setAnchor(new Messages.PlatformDoublePair.Builder().setX(0.0).setY(0.0).build()) + PlatformBitmap icon = + new PlatformBitmap( + new PlatformBitmapBytesMap( + byteArray, PlatformMapBitmapScaling.NONE, /* imagePixelRatio */ 1.0, null, null)); + PlatformDoublePair anchor = new PlatformDoublePair(0.5, 0.0); + PlatformInfoWindow infoWindow = new PlatformInfoWindow(null, null, anchor); + return new PlatformMarkerBuilder() + .setPosition(new PlatformLatLng(0.0, 0.0)) + .setAnchor(new PlatformDoublePair(0.0, 0.0)) .setFlat(false) .setDraggable(false) .setVisible(true) @@ -96,7 +88,7 @@ public void setUp() { mocksClosable = MockitoAnnotations.openMocks(this); assetManager = ApplicationProvider.getApplicationContext().getAssets(); context = ApplicationProvider.getApplicationContext(); - flutterApi = spy(new MapsCallbackApi(mock(BinaryMessenger.class))); + flutterApi = spy(new MapsCallbackApi(mock(BinaryMessenger.class), "")); clusterManagersController = spy(new ClusterManagersController(flutterApi, context, PlatformMarkerType.MARKER)); controller = @@ -130,7 +122,7 @@ public void controller_OnMarkerDragStart() { final LatLng latLng = new LatLng(1.1, 2.2); - final List markers = + final List markers = Collections.singletonList(defaultMarkerBuilder().setMarkerId(googleMarkerId).build()); controller.addMarkers(markers); controller.onMarkerDragStart(googleMarkerId, latLng); @@ -150,7 +142,7 @@ public void controller_OnMarkerDragEnd() { final LatLng latLng = new LatLng(1.1, 2.2); - final List markers = + final List markers = Collections.singletonList(defaultMarkerBuilder().setMarkerId(googleMarkerId).build()); controller.addMarkers(markers); controller.onMarkerDragEnd(googleMarkerId, latLng); @@ -170,7 +162,7 @@ public void controller_OnMarkerDrag() { final LatLng latLng = new LatLng(1.1, 2.2); - final List markers = + final List markers = Collections.singletonList(defaultMarkerBuilder().setMarkerId(googleMarkerId).build()); controller.addMarkers(markers); @@ -180,13 +172,12 @@ public void controller_OnMarkerDrag() { .onMarkerDrag(eq(googleMarkerId), eq(Convert.latLngToPigeon(latLng)), any()); } - @Test(expected = IllegalStateException.class) + @Test(expected = NullPointerException.class) public void controller_AddMarkerThrowsErrorIfMarkerIdIsNull() { - final List markers = - Collections.singletonList(defaultMarkerBuilder().build()); + final List markers = Collections.singletonList(defaultMarkerBuilder().build()); try { controller.addMarkers(markers); - } catch (IllegalStateException e) { + } catch (NullPointerException e) { assertEquals("markerId was null", e.getMessage()); throw e; } @@ -199,12 +190,11 @@ public void controller_AddChangeAndRemoveMarkerWithClusterManagerId() { final String googleMarkerId = "abc123"; final String clusterManagerId = "cm123"; - final Messages.PlatformMarker.Builder builder = defaultMarkerBuilder(); + final PlatformMarkerBuilder builder = defaultMarkerBuilder(); builder .setMarkerId(googleMarkerId) .setClusterManagerId(clusterManagerId) - .setPosition( - new Messages.PlatformLatLng.Builder().setLatitude(1.1).setLongitude(2.2).build()); + .setPosition(new PlatformLatLng(1.1, 2.2)); when(marker.getId()).thenReturn(googleMarkerId); @@ -230,15 +220,12 @@ public void controller_AddChangeAndRemoveMarkerWithClusterManagerId() { // clusterManagersController calls onClusterItemRendered with created marker. controller.onClusterItemRendered(addedMarkerBuilder[0], marker); - // Change marker to test that markerController is created and the marker can be updated + // Change marker to test that markerController is created and the marker can be + // updated final LatLng latLng2 = new LatLng(3.3, 4.4); - builder.setPosition( - new Messages.PlatformLatLng.Builder() - .setLatitude(latLng2.latitude) - .setLongitude(latLng2.longitude) - .build()); - final List updatedMarkers = Collections.singletonList(builder.build()); + builder.setPosition(new PlatformLatLng(latLng2.latitude, latLng2.longitude)); + final List updatedMarkers = Collections.singletonList(builder.build()); controller.changeMarkers(updatedMarkers); Mockito.verify(marker, times(1)).setPosition(latLng2); @@ -250,9 +237,11 @@ public void controller_AddChangeAndRemoveMarkerWithClusterManagerId() { .removeItems( eq(clusterManagerId), Mockito.argThat( - markerBuilders -> - markerBuilders.size() == 1 - && markerBuilders.get(0).clusterManagerId().equals(clusterManagerId))); + PlatformMarkerBuilders -> + PlatformMarkerBuilders.size() == 1 + && PlatformMarkerBuilders.get(0) + .clusterManagerId() + .equals(clusterManagerId))); } @Test @@ -267,7 +256,7 @@ public void controller_AddChangeAndRemoveMarkerWithoutClusterManagerId() { when(marker.getId()).thenReturn(googleMarkerId); when(googleMap.addMarker(any(MarkerOptions.class))).thenReturn(marker); - final Messages.PlatformMarker.Builder builder = defaultMarkerBuilder(); + final PlatformMarkerBuilder builder = defaultMarkerBuilder(); builder.setMarkerId(googleMarkerId); controller.addMarkers(Collections.singletonList(builder.build())); @@ -278,7 +267,7 @@ public void controller_AddChangeAndRemoveMarkerWithoutClusterManagerId() { final float alpha = 0.1f; - final List markerUpdates = + final List markerUpdates = Collections.singletonList(builder.setAlpha((double) alpha).build()); controller.changeMarkers(markerUpdates); Mockito.verify(marker, times(1)).setAlpha(alpha); @@ -292,8 +281,8 @@ public void controller_AddChangeAndRemoveMarkerWithoutClusterManagerId() { } @Test - public void markerBuilder_setCollisionBehavior() { - Messages.PlatformMarker platformMarker = defaultMarkerBuilder().setMarkerId("1").build(); + public void PlatformMarkerBuilder_setCollisionBehavior() { + PlatformMarker platformMarker = defaultMarkerBuilder().setMarkerId("1").build(); MarkerBuilder markerBuilder = new MarkerBuilder("m_1", "1", PlatformMarkerType.ADVANCED_MARKER); // Default collision behavior of an AdvancedMarker @@ -332,17 +321,13 @@ public void controller_BatchAddMultipleMarkersWithClusterManagerId() { final String clusterManagerId = "cm123"; // Create multiple markers with the same cluster manager - final List markers = new ArrayList<>(); + final List markers = new ArrayList<>(); for (int i = 0; i < 5; i++) { - final Messages.PlatformMarker.Builder builder = defaultMarkerBuilder(); + final PlatformMarkerBuilder builder = defaultMarkerBuilder(); builder .setMarkerId("marker" + i) .setClusterManagerId(clusterManagerId) - .setPosition( - new Messages.PlatformLatLng.Builder() - .setLatitude(1.0 + i) - .setLongitude(2.0 + i) - .build()); + .setPosition(new PlatformLatLng(1.0 + i, 2.0 + i)); markers.add(builder.build()); } @@ -354,10 +339,9 @@ public void controller_BatchAddMultipleMarkersWithClusterManagerId() { .addItems( eq(clusterManagerId), Mockito.argThat( - markerBuilders -> - markerBuilders.size() == 5 - && markerBuilders - .stream() + PlatformMarkerBuilders -> + PlatformMarkerBuilders.size() == 5 + && PlatformMarkerBuilders.stream() .allMatch(mb -> mb.clusterManagerId().equals(clusterManagerId)))); // Verify addItem is never called (we're using batch operation) @@ -369,20 +353,16 @@ public void controller_BatchRemoveMultipleMarkersWithClusterManagerId() { final String clusterManagerId = "cm123"; // First add markers - final List markers = new ArrayList<>(); + final List markers = new ArrayList<>(); final List markerIds = new ArrayList<>(); for (int i = 0; i < 5; i++) { String markerId = "marker" + i; markerIds.add(markerId); - final Messages.PlatformMarker.Builder builder = defaultMarkerBuilder(); + final PlatformMarkerBuilder builder = defaultMarkerBuilder(); builder .setMarkerId(markerId) .setClusterManagerId(clusterManagerId) - .setPosition( - new Messages.PlatformLatLng.Builder() - .setLatitude(1.0 + i) - .setLongitude(2.0 + i) - .build()); + .setPosition(new PlatformLatLng(1.0 + i, 2.0 + i)); markers.add(builder.build()); } @@ -396,10 +376,9 @@ public void controller_BatchRemoveMultipleMarkersWithClusterManagerId() { .removeItems( eq(clusterManagerId), Mockito.argThat( - markerBuilders -> - markerBuilders.size() == 5 - && markerBuilders - .stream() + PlatformMarkerBuilders -> + PlatformMarkerBuilders.size() == 5 + && PlatformMarkerBuilders.stream() .allMatch(mb -> mb.clusterManagerId().equals(clusterManagerId)))); // Verify removeItem is never called (we're using batch operation) @@ -412,17 +391,13 @@ public void controller_BatchChangeMarkersWithClusterManagerChange() { final String clusterManagerId2 = "cm456"; // First add markers to cluster manager 1 - final List initialMarkers = new ArrayList<>(); + final List initialMarkers = new ArrayList<>(); for (int i = 0; i < 5; i++) { - final Messages.PlatformMarker.Builder builder = defaultMarkerBuilder(); + final PlatformMarkerBuilder builder = defaultMarkerBuilder(); builder .setMarkerId("marker" + i) .setClusterManagerId(clusterManagerId1) - .setPosition( - new Messages.PlatformLatLng.Builder() - .setLatitude(1.0 + i) - .setLongitude(2.0 + i) - .build()); + .setPosition(new PlatformLatLng(1.0 + i, 2.0 + i)); initialMarkers.add(builder.build()); } controller.addMarkers(initialMarkers); @@ -431,41 +406,37 @@ public void controller_BatchChangeMarkersWithClusterManagerChange() { Mockito.reset(clusterManagersController); // Now change all markers to cluster manager 2 - final List changedMarkers = new ArrayList<>(); + final List changedMarkers = new ArrayList<>(); for (int i = 0; i < 5; i++) { - final Messages.PlatformMarker.Builder builder = defaultMarkerBuilder(); + final PlatformMarkerBuilder builder = defaultMarkerBuilder(); builder .setMarkerId("marker" + i) .setClusterManagerId(clusterManagerId2) // Different cluster manager - .setPosition( - new Messages.PlatformLatLng.Builder() - .setLatitude(3.0 + i) - .setLongitude(4.0 + i) - .build()); + .setPosition(new PlatformLatLng(3.0 + i, 4.0 + i)); changedMarkers.add(builder.build()); } controller.changeMarkers(changedMarkers); - // Verify removeItems is called exactly once for cluster manager 1 with all 5 markers + // Verify removeItems is called exactly once for cluster manager 1 with all 5 + // markers Mockito.verify(clusterManagersController, times(1)) .removeItems( eq(clusterManagerId1), Mockito.argThat( - markerBuilders -> - markerBuilders.size() == 5 - && markerBuilders - .stream() + PlatformMarkerBuilders -> + PlatformMarkerBuilders.size() == 5 + && PlatformMarkerBuilders.stream() .allMatch(mb -> mb.clusterManagerId().equals(clusterManagerId1)))); - // Verify addItems is called exactly once for cluster manager 2 with all 5 markers + // Verify addItems is called exactly once for cluster manager 2 with all 5 + // markers Mockito.verify(clusterManagersController, times(1)) .addItems( eq(clusterManagerId2), Mockito.argThat( - markerBuilders -> - markerBuilders.size() == 5 - && markerBuilders - .stream() + PlatformMarkerBuilders -> + PlatformMarkerBuilders.size() == 5 + && PlatformMarkerBuilders.stream() .allMatch(mb -> mb.clusterManagerId().equals(clusterManagerId2)))); // Verify individual operations are never called (we're using batch operations) @@ -482,15 +453,14 @@ public void controller_ChangeMarkerInPlace() { when(marker.getId()).thenReturn(markerId); // Add a clustered marker - final Messages.PlatformMarker.Builder builder = defaultMarkerBuilder(); + final PlatformMarkerBuilder builder = defaultMarkerBuilder(); builder .setMarkerId(markerId) .setClusterManagerId(clusterManagerId) - .setPosition( - new Messages.PlatformLatLng.Builder().setLatitude(1.0).setLongitude(2.0).build()); + .setPosition(new PlatformLatLng(1.0, 2.0)); controller.addMarkers(Collections.singletonList(builder.build())); - // Capture the MarkerBuilder passed to addItems + // Capture the PlatformMarkerBuilder passed to addItems @SuppressWarnings("unchecked") ArgumentCaptor> captor = ArgumentCaptor.forClass(List.class); Mockito.verify(clusterManagersController).addItems(eq(clusterManagerId), captor.capture()); @@ -504,11 +474,7 @@ public void controller_ChangeMarkerInPlace() { // Change marker in place (same clusterManagerId) final LatLng newLatLng = new LatLng(3.0, 4.0); - builder.setPosition( - new Messages.PlatformLatLng.Builder() - .setLatitude(newLatLng.latitude) - .setLongitude(newLatLng.longitude) - .build()); + builder.setPosition(new PlatformLatLng(newLatLng.latitude, newLatLng.longitude)); controller.changeMarkers(Collections.singletonList(builder.build())); // In-place update: marker position is updated directly @@ -517,4 +483,112 @@ public void controller_ChangeMarkerInPlace() { Mockito.verify(clusterManagersController, times(0)).addItems(any(), any()); Mockito.verify(clusterManagersController, times(0)).removeItems(any(), any()); } + + // Remove this if builders are added to the Kotlin generator; see discussion in + // https://github.com/flutter/flutter/issues/158287 + private static final class PlatformMarkerBuilder { + private @Nullable Double alpha; + private @Nullable PlatformDoublePair anchor; + private @Nullable Boolean consumeTapEvents; + private @Nullable Boolean draggable; + private @Nullable Boolean flat; + private @Nullable PlatformBitmap icon; + private @Nullable PlatformInfoWindow infoWindow; + private @Nullable PlatformLatLng position; + private @Nullable Double rotation; + private @Nullable Boolean visible; + private @Nullable Double zIndex; + private @Nullable String markerId; + private @Nullable String clusterManagerId; + private @Nullable PlatformMarkerCollisionBehavior collisionBehavior; + + public @NonNull PlatformMarkerBuilder setAlpha(@NonNull Double setterArg) { + this.alpha = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setAnchor(@NonNull PlatformDoublePair setterArg) { + this.anchor = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setConsumeTapEvents(@NonNull Boolean setterArg) { + this.consumeTapEvents = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setDraggable(@NonNull Boolean setterArg) { + this.draggable = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setFlat(@NonNull Boolean setterArg) { + this.flat = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setIcon(@NonNull PlatformBitmap setterArg) { + this.icon = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setInfoWindow(@NonNull PlatformInfoWindow setterArg) { + this.infoWindow = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setPosition(@NonNull PlatformLatLng setterArg) { + this.position = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setRotation(@NonNull Double setterArg) { + this.rotation = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setVisible(@NonNull Boolean setterArg) { + this.visible = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setZIndex(@NonNull Double setterArg) { + this.zIndex = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setMarkerId(@NonNull String setterArg) { + this.markerId = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setClusterManagerId(@Nullable String setterArg) { + this.clusterManagerId = setterArg; + return this; + } + + public @NonNull PlatformMarkerBuilder setCollisionBehavior( + @NonNull PlatformMarkerCollisionBehavior setterArg) { + this.collisionBehavior = setterArg; + return this; + } + + public @NonNull PlatformMarker build() { + return new PlatformMarker( + Objects.requireNonNull(alpha), + Objects.requireNonNull(anchor), + Objects.requireNonNull(consumeTapEvents), + Objects.requireNonNull(draggable), + Objects.requireNonNull(flat), + Objects.requireNonNull(icon), + Objects.requireNonNull(infoWindow), + Objects.requireNonNull(position), + Objects.requireNonNull(rotation), + Objects.requireNonNull(visible), + Objects.requireNonNull(zIndex), + Objects.requireNonNull(markerId), + clusterManagerId, + Objects.requireNonNull(collisionBehavior)); + } + } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_marker_icons.dart index c999b87688c7..6277e7ccc418 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_marker_icons.dart @@ -12,12 +12,8 @@ import 'place_advanced_marker.dart'; /// Page that demonstrates how to use custom [AdvanceMarker] icons. class AdvancedMarkerIconsPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerIconsPage({required this.mapId, Key? key}) - : super( - key: key, - const Icon(Icons.image_outlined), - 'Advanced marker icons', - ); + const AdvancedMarkerIconsPage({required this.mapId, super.key}) + : super(const Icon(Icons.image_outlined), 'Advanced marker icons'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_markers_clustering.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_markers_clustering.dart index 220f60594f71..d7d305864f65 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_markers_clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/advanced_markers_clustering.dart @@ -16,9 +16,8 @@ import 'place_advanced_marker.dart'; /// Same as [ClusteringPage] but works with [AdvancedMarker]. class AdvancedMarkersClusteringPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkersClusteringPage({Key? key, required this.mapId}) + const AdvancedMarkersClusteringPage({super.key, required this.mapId}) : super( - key: key, const Icon(Icons.place_outlined), 'Manage clusters of advanced markers', ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/animate_camera.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/animate_camera.dart index a7c515c36928..001006fb54be 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/animate_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/animate_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class AnimateCameraPage extends GoogleMapExampleAppPage { - const AnimateCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control, animated', key: key); + const AnimateCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control, animated'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart index 5782015c4407..b684d0ff6476 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/clustering.dart @@ -13,8 +13,8 @@ import 'page.dart'; /// Page for demonstrating marker clustering support. class ClusteringPage extends GoogleMapExampleAppPage { /// Default Constructor. - const ClusteringPage({Key? key}) - : super(const Icon(Icons.place), 'Manage clustering', key: key); + const ClusteringPage({super.key}) + : super(const Icon(Icons.place), 'Manage clustering'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/collision_behavior.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/collision_behavior.dart index 411c27aebb7c..202bb0c203d3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/collision_behavior.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/collision_behavior.dart @@ -14,11 +14,10 @@ import 'place_advanced_marker.dart'; /// Page demonstrating how to use AdvancedMarker's collision behavior. class AdvancedMarkerCollisionBehaviorPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerCollisionBehaviorPage({Key? key, required this.mapId}) + const AdvancedMarkerCollisionBehaviorPage({super.key, required this.mapId}) : super( const Icon(Icons.not_listed_location), 'Advanced marker collision behavior', - key: key, ); /// Map ID to use for the GoogleMap. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart index 2f1937b04fbf..c311e40c02c5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/ground_overlay.dart @@ -13,8 +13,8 @@ import 'page.dart'; enum _GroundOverlayPlacing { position, bounds } class GroundOverlayPage extends GoogleMapExampleAppPage { - const GroundOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Ground overlay', key: key); + const GroundOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Ground overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/lite_mode.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/lite_mode.dart index e4df7d5ac0ae..cc4f8f2f7312 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/lite_mode.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/lite_mode.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class LiteModePage extends GoogleMapExampleAppPage { - const LiteModePage({Key? key}) - : super(const Icon(Icons.map), 'Lite mode', key: key); + const LiteModePage({super.key}) : super(const Icon(Icons.map), 'Lite mode'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart index 4d45e961d63e..a786197d5205 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_click.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapClickPage extends GoogleMapExampleAppPage { - const MapClickPage({Key? key}) - : super(const Icon(Icons.mouse), 'Map click', key: key); + const MapClickPage({super.key}) : super(const Icon(Icons.mouse), 'Map click'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart index 5ec74b708a4b..085366918f07 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_coordinates.dart @@ -16,8 +16,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapCoordinatesPage extends GoogleMapExampleAppPage { - const MapCoordinatesPage({Key? key}) - : super(const Icon(Icons.map), 'Map coordinates', key: key); + const MapCoordinatesPage({super.key}) + : super(const Icon(Icons.map), 'Map coordinates'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart index 3b4f2831002c..4317a2d15cd4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart @@ -13,8 +13,8 @@ import 'main.dart'; import 'page.dart'; class MapIdPage extends GoogleMapExampleAppPage { - const MapIdPage({Key? key}) - : super(const Icon(Icons.map), 'Cloud-based maps styling', key: key); + const MapIdPage({super.key}) + : super(const Icon(Icons.map), 'Cloud-based maps styling'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart index ce0d7d68378f..8358f661109b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_ui.dart @@ -17,8 +17,7 @@ final LatLngBounds sydneyBounds = LatLngBounds( ); class MapUiPage extends GoogleMapExampleAppPage { - const MapUiPage({Key? key}) - : super(const Icon(Icons.map), 'User interface', key: key); + const MapUiPage({super.key}) : super(const Icon(Icons.map), 'User interface'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart index 20663eda8282..d4ac8d6ac597 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/marker_icons.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MarkerIconsPage extends GoogleMapExampleAppPage { - const MarkerIconsPage({Key? key}) - : super(const Icon(Icons.image), 'Marker icons', key: key); + const MarkerIconsPage({super.key}) + : super(const Icon(Icons.image), 'Marker icons'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/move_camera.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/move_camera.dart index bc6fcdea2651..5fc48e659246 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/move_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/move_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MoveCameraPage extends GoogleMapExampleAppPage { - const MoveCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control', key: key); + const MoveCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart index beb39b305f58..a0f4f8521c8e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/padding.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PaddingPage extends GoogleMapExampleAppPage { - const PaddingPage({Key? key}) - : super(const Icon(Icons.map), 'Add padding to the map', key: key); + const PaddingPage({super.key}) + : super(const Icon(Icons.map), 'Add padding to the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_advanced_marker.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_advanced_marker.dart index 532d43da39d9..0dcf1f92b8a6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_advanced_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_advanced_marker.dart @@ -13,12 +13,8 @@ import 'page.dart'; /// Page demonstrating how to use Advanced [Marker] class. class PlaceAdvancedMarkerPage extends GoogleMapExampleAppPage { /// Default constructor. - const PlaceAdvancedMarkerPage({Key? key, required this.mapId}) - : super( - const Icon(Icons.place_outlined), - 'Place advanced marker', - key: key, - ); + const PlaceAdvancedMarkerPage({super.key, required this.mapId}) + : super(const Icon(Icons.place_outlined), 'Place advanced marker'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart index 88c84c79e124..3c0335bfd18b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_circle.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceCirclePage extends GoogleMapExampleAppPage { - const PlaceCirclePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place circle', key: key); + const PlaceCirclePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place circle'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart index 93c01eef27eb..3f6509d1c2f7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_marker.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceMarkerPage extends GoogleMapExampleAppPage { - const PlaceMarkerPage({Key? key}) - : super(const Icon(Icons.place), 'Place marker', key: key); + const PlaceMarkerPage({super.key}) + : super(const Icon(Icons.place), 'Place marker'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart index ff9eac82210c..70ad42c93724 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polygon.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolygonPage extends GoogleMapExampleAppPage { - const PlacePolygonPage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polygon', key: key); + const PlacePolygonPage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polygon'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart index f749cac5f268..8703ffcbd68f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/place_polyline.dart @@ -12,8 +12,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolylinePage extends GoogleMapExampleAppPage { - const PlacePolylinePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polyline', key: key); + const PlacePolylinePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polyline'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/scrolling_map.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/scrolling_map.dart index 57d8cd6d9ff4..e5a8ec2ce5a6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/scrolling_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/scrolling_map.dart @@ -15,8 +15,8 @@ import 'page.dart'; const LatLng _center = LatLng(32.080664, 34.9563837); class ScrollingMapPage extends GoogleMapExampleAppPage { - const ScrollingMapPage({Key? key}) - : super(const Icon(Icons.map), 'Scrolling map', key: key); + const ScrollingMapPage({super.key}) + : super(const Icon(Icons.map), 'Scrolling map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/snapshot.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/snapshot.dart index 8fa4d67b6422..6f1624234ec4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/snapshot.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/snapshot.dart @@ -18,12 +18,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class SnapshotPage extends GoogleMapExampleAppPage { - const SnapshotPage({Key? key}) - : super( - const Icon(Icons.camera_alt), - 'Take a snapshot of the map', - key: key, - ); + const SnapshotPage({super.key}) + : super(const Icon(Icons.camera_alt), 'Take a snapshot of the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart index bcce3b5f387b..cefa70eb34d5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/tile_overlay.dart @@ -14,8 +14,8 @@ import 'example_google_map.dart'; import 'page.dart'; class TileOverlayPage extends GoogleMapExampleAppPage { - const TileOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Tile overlay', key: key); + const TileOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Tile overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart index ba00ef7babed..0a6d16953c98 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart @@ -1,21 +1,40 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.5), do not edit directly. +// Autogenerated from Pigeon (v26.3.4), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } List wrapResponse({ @@ -33,6 +52,15 @@ List wrapResponse({ } bool _deepEquals(Object? a, Object? b) { + if (identical(a, b)) { + return true; + } + if (a is double && b is double) { + if (a.isNaN && b.isNaN) { + return true; + } + return a == b; + } if (a is List && b is List) { return a.length == b.length && a.indexed.every( @@ -40,16 +68,52 @@ bool _deepEquals(Object? a, Object? b) { ); } if (a is Map && b is Map) { - return a.length == b.length && - a.entries.every( - (MapEntry entry) => - (b as Map).containsKey(entry.key) && - _deepEquals(entry.value, b[entry.key]), - ); + if (a.length != b.length) { + return false; + } + for (final MapEntry entryA in a.entries) { + bool found = false; + for (final MapEntry entryB in b.entries) { + if (_deepEquals(entryA.key, entryB.key)) { + if (_deepEquals(entryA.value, entryB.value)) { + found = true; + break; + } else { + return false; + } + } + } + if (!found) { + return false; + } + } + return true; } return a == b; } +int _deepHash(Object? value) { + if (value is List) { + return Object.hashAll(value.map(_deepHash)); + } + if (value is Map) { + int result = 0; + for (final MapEntry entry in value.entries) { + result += (_deepHash(entry.key) * 31) ^ _deepHash(entry.value); + } + return result; + } + if (value is double && value.isNaN) { + // Normalize NaN to a consistent hash. + return 0x7FF8000000000000.hashCode; + } + if (value is double && value == 0.0) { + // Normalize -0.0 to 0.0 so they have the same hash code. + return 0.0.hashCode; + } + return value.hashCode; +} + /// Pigeon equivalent of MapType enum PlatformMapType { none, normal, satellite, terrain, hybrid } @@ -121,12 +185,15 @@ class PlatformCameraPosition { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(bearing, other.bearing) && + _deepEquals(target, other.target) && + _deepEquals(tilt, other.tilt) && + _deepEquals(zoom, other.zoom); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon representation of a CameraUpdate. @@ -163,12 +230,12 @@ class PlatformCameraUpdate { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(cameraUpdate, other.cameraUpdate); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of NewCameraPosition @@ -202,12 +269,12 @@ class PlatformCameraUpdateNewCameraPosition { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(cameraPosition, other.cameraPosition); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of NewLatLng @@ -239,12 +306,12 @@ class PlatformCameraUpdateNewLatLng { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(latLng, other.latLng); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of NewLatLngBounds @@ -284,12 +351,13 @@ class PlatformCameraUpdateNewLatLngBounds { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(bounds, other.bounds) && + _deepEquals(padding, other.padding); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of NewLatLngZoom @@ -326,12 +394,12 @@ class PlatformCameraUpdateNewLatLngZoom { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(latLng, other.latLng) && _deepEquals(zoom, other.zoom); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of ScrollBy @@ -368,12 +436,12 @@ class PlatformCameraUpdateScrollBy { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(dx, other.dx) && _deepEquals(dy, other.dy); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of ZoomBy @@ -410,12 +478,12 @@ class PlatformCameraUpdateZoomBy { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(amount, other.amount) && _deepEquals(focus, other.focus); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of ZoomIn/ZoomOut @@ -447,12 +515,12 @@ class PlatformCameraUpdateZoom { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(out, other.out); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of ZoomTo @@ -484,12 +552,12 @@ class PlatformCameraUpdateZoomTo { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(zoom, other.zoom); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the Circle class. @@ -566,12 +634,20 @@ class PlatformCircle { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(consumeTapEvents, other.consumeTapEvents) && + _deepEquals(fillColor, other.fillColor) && + _deepEquals(strokeColor, other.strokeColor) && + _deepEquals(visible, other.visible) && + _deepEquals(strokeWidth, other.strokeWidth) && + _deepEquals(zIndex, other.zIndex) && + _deepEquals(center, other.center) && + _deepEquals(radius, other.radius) && + _deepEquals(circleId, other.circleId); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the Heatmap class. @@ -609,7 +685,7 @@ class PlatformHeatmap { result as List; return PlatformHeatmap( heatmapId: result[0]! as String, - data: (result[1] as List?)!.cast(), + data: (result[1]! as List).cast(), gradient: result[2] as PlatformHeatmapGradient?, opacity: result[3]! as double, radius: result[4]! as int, @@ -626,12 +702,17 @@ class PlatformHeatmap { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(heatmapId, other.heatmapId) && + _deepEquals(data, other.data) && + _deepEquals(gradient, other.gradient) && + _deepEquals(opacity, other.opacity) && + _deepEquals(radius, other.radius) && + _deepEquals(maxIntensity, other.maxIntensity); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the HeatmapGradient class. @@ -663,8 +744,8 @@ class PlatformHeatmapGradient { static PlatformHeatmapGradient decode(Object result) { result as List; return PlatformHeatmapGradient( - colors: (result[0] as List?)!.cast(), - startPoints: (result[1] as List?)!.cast(), + colors: (result[0]! as List).cast(), + startPoints: (result[1]! as List).cast(), colorMapSize: result[2]! as int, ); } @@ -678,12 +759,14 @@ class PlatformHeatmapGradient { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(colors, other.colors) && + _deepEquals(startPoints, other.startPoints) && + _deepEquals(colorMapSize, other.colorMapSize); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the WeightedLatLng class. @@ -719,12 +802,12 @@ class PlatformWeightedLatLng { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(point, other.point) && _deepEquals(weight, other.weight); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the ClusterManager class. @@ -755,12 +838,12 @@ class PlatformClusterManager { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(identifier, other.identifier); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pair of double values, such as for an offset or size. @@ -793,12 +876,12 @@ class PlatformDoublePair { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(x, other.x) && _deepEquals(y, other.y); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the Color class. @@ -831,12 +914,12 @@ class PlatformColor { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(argbValue, other.argbValue); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the InfoWindow class. @@ -875,12 +958,14 @@ class PlatformInfoWindow { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(title, other.title) && + _deepEquals(snippet, other.snippet) && + _deepEquals(anchor, other.anchor); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the Marker class. @@ -982,12 +1067,25 @@ class PlatformMarker { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(alpha, other.alpha) && + _deepEquals(anchor, other.anchor) && + _deepEquals(consumeTapEvents, other.consumeTapEvents) && + _deepEquals(draggable, other.draggable) && + _deepEquals(flat, other.flat) && + _deepEquals(icon, other.icon) && + _deepEquals(infoWindow, other.infoWindow) && + _deepEquals(position, other.position) && + _deepEquals(rotation, other.rotation) && + _deepEquals(visible, other.visible) && + _deepEquals(zIndex, other.zIndex) && + _deepEquals(markerId, other.markerId) && + _deepEquals(clusterManagerId, other.clusterManagerId) && + _deepEquals(collisionBehavior, other.collisionBehavior); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the Polygon class. @@ -1051,8 +1149,8 @@ class PlatformPolygon { consumesTapEvents: result[1]! as bool, fillColor: result[2]! as PlatformColor, geodesic: result[3]! as bool, - points: (result[4] as List?)!.cast(), - holes: (result[5] as List?)!.cast>(), + points: (result[4]! as List).cast(), + holes: (result[5]! as List).cast>(), visible: result[6]! as bool, strokeColor: result[7]! as PlatformColor, strokeWidth: result[8]! as int, @@ -1069,12 +1167,21 @@ class PlatformPolygon { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(polygonId, other.polygonId) && + _deepEquals(consumesTapEvents, other.consumesTapEvents) && + _deepEquals(fillColor, other.fillColor) && + _deepEquals(geodesic, other.geodesic) && + _deepEquals(points, other.points) && + _deepEquals(holes, other.holes) && + _deepEquals(visible, other.visible) && + _deepEquals(strokeColor, other.strokeColor) && + _deepEquals(strokeWidth, other.strokeWidth) && + _deepEquals(zIndex, other.zIndex); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the Polyline class. @@ -1151,8 +1258,8 @@ class PlatformPolyline { color: result[2]! as PlatformColor, geodesic: result[3]! as bool, jointType: result[4]! as PlatformJointType, - patterns: (result[5] as List?)!.cast(), - points: (result[6] as List?)!.cast(), + patterns: (result[5]! as List).cast(), + points: (result[6]! as List).cast(), startCap: result[7]! as PlatformCap, endCap: result[8]! as PlatformCap, visible: result[9]! as bool, @@ -1170,12 +1277,23 @@ class PlatformPolyline { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(polylineId, other.polylineId) && + _deepEquals(consumesTapEvents, other.consumesTapEvents) && + _deepEquals(color, other.color) && + _deepEquals(geodesic, other.geodesic) && + _deepEquals(jointType, other.jointType) && + _deepEquals(patterns, other.patterns) && + _deepEquals(points, other.points) && + _deepEquals(startCap, other.startCap) && + _deepEquals(endCap, other.endCap) && + _deepEquals(visible, other.visible) && + _deepEquals(width, other.width) && + _deepEquals(zIndex, other.zIndex); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of Cap from the platform interface. @@ -1215,12 +1333,14 @@ class PlatformCap { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(type, other.type) && + _deepEquals(bitmapDescriptor, other.bitmapDescriptor) && + _deepEquals(refWidth, other.refWidth); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the PatternItem class. @@ -1256,12 +1376,12 @@ class PlatformPatternItem { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(type, other.type) && _deepEquals(length, other.length); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the Tile class. @@ -1300,12 +1420,14 @@ class PlatformTile { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(width, other.width) && + _deepEquals(height, other.height) && + _deepEquals(data, other.data); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the TileOverlay class. @@ -1367,12 +1489,17 @@ class PlatformTileOverlay { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(tileOverlayId, other.tileOverlayId) && + _deepEquals(fadeIn, other.fadeIn) && + _deepEquals(transparency, other.transparency) && + _deepEquals(zIndex, other.zIndex) && + _deepEquals(visible, other.visible) && + _deepEquals(tileSize, other.tileSize); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of Flutter's EdgeInsets. @@ -1419,12 +1546,15 @@ class PlatformEdgeInsets { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(top, other.top) && + _deepEquals(bottom, other.bottom) && + _deepEquals(left, other.left) && + _deepEquals(right, other.right); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of LatLng. @@ -1460,12 +1590,13 @@ class PlatformLatLng { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(latitude, other.latitude) && + _deepEquals(longitude, other.longitude); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of LatLngBounds. @@ -1501,12 +1632,13 @@ class PlatformLatLngBounds { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(northeast, other.northeast) && + _deepEquals(southwest, other.southwest); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of Cluster. @@ -1540,7 +1672,7 @@ class PlatformCluster { clusterManagerId: result[0]! as String, position: result[1]! as PlatformLatLng, bounds: result[2]! as PlatformLatLngBounds, - markerIds: (result[3] as List?)!.cast(), + markerIds: (result[3]! as List).cast(), ); } @@ -1553,12 +1685,15 @@ class PlatformCluster { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(clusterManagerId, other.clusterManagerId) && + _deepEquals(position, other.position) && + _deepEquals(bounds, other.bounds) && + _deepEquals(markerIds, other.markerIds); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of the GroundOverlay class. @@ -1650,12 +1785,23 @@ class PlatformGroundOverlay { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(groundOverlayId, other.groundOverlayId) && + _deepEquals(image, other.image) && + _deepEquals(position, other.position) && + _deepEquals(bounds, other.bounds) && + _deepEquals(width, other.width) && + _deepEquals(height, other.height) && + _deepEquals(anchor, other.anchor) && + _deepEquals(transparency, other.transparency) && + _deepEquals(bearing, other.bearing) && + _deepEquals(zIndex, other.zIndex) && + _deepEquals(visible, other.visible) && + _deepEquals(clickable, other.clickable); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of CameraTargetBounds. @@ -1692,12 +1838,12 @@ class PlatformCameraTargetBounds { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(bounds, other.bounds); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Information passed to the platform view creation. @@ -1759,16 +1905,16 @@ class PlatformMapViewCreationParams { return PlatformMapViewCreationParams( initialCameraPosition: result[0]! as PlatformCameraPosition, mapConfiguration: result[1]! as PlatformMapConfiguration, - initialCircles: (result[2] as List?)!.cast(), - initialMarkers: (result[3] as List?)!.cast(), - initialPolygons: (result[4] as List?)!.cast(), - initialPolylines: (result[5] as List?)!.cast(), - initialHeatmaps: (result[6] as List?)!.cast(), - initialTileOverlays: (result[7] as List?)! + initialCircles: (result[2]! as List).cast(), + initialMarkers: (result[3]! as List).cast(), + initialPolygons: (result[4]! as List).cast(), + initialPolylines: (result[5]! as List).cast(), + initialHeatmaps: (result[6]! as List).cast(), + initialTileOverlays: (result[7]! as List) .cast(), - initialClusterManagers: (result[8] as List?)! + initialClusterManagers: (result[8]! as List) .cast(), - initialGroundOverlays: (result[9] as List?)! + initialGroundOverlays: (result[9]! as List) .cast(), ); } @@ -1783,12 +1929,21 @@ class PlatformMapViewCreationParams { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(initialCameraPosition, other.initialCameraPosition) && + _deepEquals(mapConfiguration, other.mapConfiguration) && + _deepEquals(initialCircles, other.initialCircles) && + _deepEquals(initialMarkers, other.initialMarkers) && + _deepEquals(initialPolygons, other.initialPolygons) && + _deepEquals(initialPolylines, other.initialPolylines) && + _deepEquals(initialHeatmaps, other.initialHeatmaps) && + _deepEquals(initialTileOverlays, other.initialTileOverlays) && + _deepEquals(initialClusterManagers, other.initialClusterManagers) && + _deepEquals(initialGroundOverlays, other.initialGroundOverlays); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of MapConfiguration. @@ -1926,12 +2081,32 @@ class PlatformMapConfiguration { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(compassEnabled, other.compassEnabled) && + _deepEquals(cameraTargetBounds, other.cameraTargetBounds) && + _deepEquals(mapType, other.mapType) && + _deepEquals(minMaxZoomPreference, other.minMaxZoomPreference) && + _deepEquals(mapToolbarEnabled, other.mapToolbarEnabled) && + _deepEquals(rotateGesturesEnabled, other.rotateGesturesEnabled) && + _deepEquals(scrollGesturesEnabled, other.scrollGesturesEnabled) && + _deepEquals(tiltGesturesEnabled, other.tiltGesturesEnabled) && + _deepEquals(trackCameraPosition, other.trackCameraPosition) && + _deepEquals(zoomControlsEnabled, other.zoomControlsEnabled) && + _deepEquals(zoomGesturesEnabled, other.zoomGesturesEnabled) && + _deepEquals(myLocationEnabled, other.myLocationEnabled) && + _deepEquals(myLocationButtonEnabled, other.myLocationButtonEnabled) && + _deepEquals(padding, other.padding) && + _deepEquals(indoorViewEnabled, other.indoorViewEnabled) && + _deepEquals(trafficEnabled, other.trafficEnabled) && + _deepEquals(buildingsEnabled, other.buildingsEnabled) && + _deepEquals(liteModeEnabled, other.liteModeEnabled) && + _deepEquals(markerType, other.markerType) && + _deepEquals(mapId, other.mapId) && + _deepEquals(style, other.style); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon representation of an x,y coordinate. @@ -1964,12 +2139,12 @@ class PlatformPoint { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(x, other.x) && _deepEquals(y, other.y); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of native TileOverlay properties. @@ -2016,12 +2191,15 @@ class PlatformTileLayer { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(visible, other.visible) && + _deepEquals(fadeIn, other.fadeIn) && + _deepEquals(transparency, other.transparency) && + _deepEquals(zIndex, other.zIndex); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Possible outcomes of launching a URL. @@ -2057,12 +2235,12 @@ class PlatformZoomRange { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(min, other.min) && _deepEquals(max, other.max); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [BitmapDescriptor]. As there are multiple disjoint @@ -2102,12 +2280,12 @@ class PlatformBitmap { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(bitmap, other.bitmap); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [DefaultMarker]. See @@ -2140,12 +2318,12 @@ class PlatformBitmapDefaultMarker { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(hue, other.hue); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [BytesBitmap]. See @@ -2182,12 +2360,13 @@ class PlatformBitmapBytes { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(byteData, other.byteData) && + _deepEquals(size, other.size); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [AssetBitmap]. See @@ -2224,12 +2403,12 @@ class PlatformBitmapAsset { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(name, other.name) && _deepEquals(pkg, other.pkg); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [AssetImageBitmap]. See @@ -2274,12 +2453,14 @@ class PlatformBitmapAssetImage { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(name, other.name) && + _deepEquals(scale, other.scale) && + _deepEquals(size, other.size); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [AssetMapBitmap]. See @@ -2331,12 +2512,16 @@ class PlatformBitmapAssetMap { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(assetName, other.assetName) && + _deepEquals(bitmapScaling, other.bitmapScaling) && + _deepEquals(imagePixelRatio, other.imagePixelRatio) && + _deepEquals(width, other.width) && + _deepEquals(height, other.height); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [BytesMapBitmap]. See @@ -2388,12 +2573,16 @@ class PlatformBitmapBytesMap { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(byteData, other.byteData) && + _deepEquals(bitmapScaling, other.bitmapScaling) && + _deepEquals(imagePixelRatio, other.imagePixelRatio) && + _deepEquals(width, other.width) && + _deepEquals(height, other.height); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Pigeon equivalent of [PinConfig]. @@ -2455,12 +2644,17 @@ class PlatformBitmapPinConfig { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(backgroundColor, other.backgroundColor) && + _deepEquals(borderColor, other.borderColor) && + _deepEquals(glyphColor, other.glyphColor) && + _deepEquals(glyphBitmap, other.glyphBitmap) && + _deepEquals(glyphText, other.glyphText) && + _deepEquals(glyphTextColor, other.glyphTextColor); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } class _PigeonCodec extends StandardMessageCodec { @@ -2783,17 +2977,12 @@ class MapsApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the map's configuration options. @@ -2814,17 +3003,12 @@ class MapsApi { [configuration], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of circles on the map. @@ -2844,17 +3028,12 @@ class MapsApi { [toAdd, toChange, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of heatmaps on the map. @@ -2874,17 +3053,12 @@ class MapsApi { [toAdd, toChange, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of custer managers for clusters on the map. @@ -2903,17 +3077,12 @@ class MapsApi { [toAdd, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of markers on the map. @@ -2933,17 +3102,12 @@ class MapsApi { [toAdd, toChange, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of polygonss on the map. @@ -2963,17 +3127,12 @@ class MapsApi { [toAdd, toChange, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of polylines on the map. @@ -2993,17 +3152,12 @@ class MapsApi { [toAdd, toChange, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of tile overlays on the map. @@ -3023,17 +3177,12 @@ class MapsApi { [toAdd, toChange, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Updates the set of ground overlays on the map. @@ -3053,17 +3202,12 @@ class MapsApi { [toAdd, toChange, idsToRemove], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Gets the screen coordinate for the given map location. @@ -3079,22 +3223,13 @@ class MapsApi { [latLng], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as PlatformPoint?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as PlatformPoint; } /// Gets the map location for the given screen coordinate. @@ -3110,22 +3245,13 @@ class MapsApi { [screenCoordinate], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as PlatformLatLng?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as PlatformLatLng; } /// Gets the map region currently displayed on the map. @@ -3139,22 +3265,13 @@ class MapsApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as PlatformLatLngBounds?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as PlatformLatLngBounds; } /// Moves the camera according to [cameraUpdate] immediately, with no @@ -3171,17 +3288,12 @@ class MapsApi { [cameraUpdate], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Moves the camera according to [cameraUpdate], animating the update using a @@ -3201,17 +3313,12 @@ class MapsApi { [cameraUpdate, durationMilliseconds], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Gets the current map zoom level. @@ -3225,22 +3332,13 @@ class MapsApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as double?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as double; } /// Show the info window for the marker with the given ID. @@ -3256,17 +3354,12 @@ class MapsApi { [markerId], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Hide the info window for the marker with the given ID. @@ -3282,17 +3375,12 @@ class MapsApi { [markerId], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Returns true if the marker with the given ID is currently displaying its @@ -3309,22 +3397,13 @@ class MapsApi { [markerId], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Sets the style to the given map style string, where an empty string @@ -3344,22 +3423,13 @@ class MapsApi { [style], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Returns true if the last attempt to set a style, either via initial map @@ -3377,22 +3447,13 @@ class MapsApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Returns true if this map supports advanced markers. @@ -3409,22 +3470,13 @@ class MapsApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Clears the cache of tiles previously requseted from the tile provider. @@ -3440,17 +3492,12 @@ class MapsApi { [tileOverlayId], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Takes a snapshot of the map and returns its image data. @@ -3464,22 +3511,13 @@ class MapsApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Uint8List?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as Uint8List; } } @@ -3579,19 +3617,11 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMove was null.', - ); - final List args = (message as List?)!; - final PlatformCameraPosition? arg_cameraPosition = - (args[0] as PlatformCameraPosition?); - assert( - arg_cameraPosition != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCameraMove was null, expected non-null PlatformCameraPosition.', - ); + final List args = message! as List; + final PlatformCameraPosition arg_cameraPosition = + args[0]! as PlatformCameraPosition; try { - api.onCameraMove(arg_cameraPosition!); + api.onCameraMove(arg_cameraPosition); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3636,18 +3666,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onTap was null.', - ); - final List args = (message as List?)!; - final PlatformLatLng? arg_position = (args[0] as PlatformLatLng?); - assert( - arg_position != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onTap was null, expected non-null PlatformLatLng.', - ); + final List args = message! as List; + final PlatformLatLng arg_position = args[0]! as PlatformLatLng; try { - api.onTap(arg_position!); + api.onTap(arg_position); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3669,18 +3691,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onLongPress was null.', - ); - final List args = (message as List?)!; - final PlatformLatLng? arg_position = (args[0] as PlatformLatLng?); - assert( - arg_position != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onLongPress was null, expected non-null PlatformLatLng.', - ); + final List args = message! as List; + final PlatformLatLng arg_position = args[0]! as PlatformLatLng; try { - api.onLongPress(arg_position!); + api.onLongPress(arg_position); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3702,18 +3716,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerTap was null.', - ); - final List args = (message as List?)!; - final String? arg_markerId = (args[0] as String?); - assert( - arg_markerId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerTap was null, expected non-null String.', - ); + final List args = message! as List; + final String arg_markerId = args[0]! as String; try { - api.onMarkerTap(arg_markerId!); + api.onMarkerTap(arg_markerId); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3735,23 +3741,11 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragStart was null.', - ); - final List args = (message as List?)!; - final String? arg_markerId = (args[0] as String?); - assert( - arg_markerId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragStart was null, expected non-null String.', - ); - final PlatformLatLng? arg_position = (args[1] as PlatformLatLng?); - assert( - arg_position != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragStart was null, expected non-null PlatformLatLng.', - ); + final List args = message! as List; + final String arg_markerId = args[0]! as String; + final PlatformLatLng arg_position = args[1]! as PlatformLatLng; try { - api.onMarkerDragStart(arg_markerId!, arg_position!); + api.onMarkerDragStart(arg_markerId, arg_position); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3773,23 +3767,11 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDrag was null.', - ); - final List args = (message as List?)!; - final String? arg_markerId = (args[0] as String?); - assert( - arg_markerId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDrag was null, expected non-null String.', - ); - final PlatformLatLng? arg_position = (args[1] as PlatformLatLng?); - assert( - arg_position != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDrag was null, expected non-null PlatformLatLng.', - ); + final List args = message! as List; + final String arg_markerId = args[0]! as String; + final PlatformLatLng arg_position = args[1]! as PlatformLatLng; try { - api.onMarkerDrag(arg_markerId!, arg_position!); + api.onMarkerDrag(arg_markerId, arg_position); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3811,23 +3793,11 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragEnd was null.', - ); - final List args = (message as List?)!; - final String? arg_markerId = (args[0] as String?); - assert( - arg_markerId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragEnd was null, expected non-null String.', - ); - final PlatformLatLng? arg_position = (args[1] as PlatformLatLng?); - assert( - arg_position != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onMarkerDragEnd was null, expected non-null PlatformLatLng.', - ); + final List args = message! as List; + final String arg_markerId = args[0]! as String; + final PlatformLatLng arg_position = args[1]! as PlatformLatLng; try { - api.onMarkerDragEnd(arg_markerId!, arg_position!); + api.onMarkerDragEnd(arg_markerId, arg_position); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3849,18 +3819,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onInfoWindowTap was null.', - ); - final List args = (message as List?)!; - final String? arg_markerId = (args[0] as String?); - assert( - arg_markerId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onInfoWindowTap was null, expected non-null String.', - ); + final List args = message! as List; + final String arg_markerId = args[0]! as String; try { - api.onInfoWindowTap(arg_markerId!); + api.onInfoWindowTap(arg_markerId); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3882,18 +3844,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCircleTap was null.', - ); - final List args = (message as List?)!; - final String? arg_circleId = (args[0] as String?); - assert( - arg_circleId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onCircleTap was null, expected non-null String.', - ); + final List args = message! as List; + final String arg_circleId = args[0]! as String; try { - api.onCircleTap(arg_circleId!); + api.onCircleTap(arg_circleId); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3915,18 +3869,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onClusterTap was null.', - ); - final List args = (message as List?)!; - final PlatformCluster? arg_cluster = (args[0] as PlatformCluster?); - assert( - arg_cluster != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onClusterTap was null, expected non-null PlatformCluster.', - ); + final List args = message! as List; + final PlatformCluster arg_cluster = args[0]! as PlatformCluster; try { - api.onClusterTap(arg_cluster!); + api.onClusterTap(arg_cluster); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3948,18 +3894,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolygonTap was null.', - ); - final List args = (message as List?)!; - final String? arg_polygonId = (args[0] as String?); - assert( - arg_polygonId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolygonTap was null, expected non-null String.', - ); + final List args = message! as List; + final String arg_polygonId = args[0]! as String; try { - api.onPolygonTap(arg_polygonId!); + api.onPolygonTap(arg_polygonId); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3981,18 +3919,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolylineTap was null.', - ); - final List args = (message as List?)!; - final String? arg_polylineId = (args[0] as String?); - assert( - arg_polylineId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onPolylineTap was null, expected non-null String.', - ); + final List args = message! as List; + final String arg_polylineId = args[0]! as String; try { - api.onPolylineTap(arg_polylineId!); + api.onPolylineTap(arg_polylineId); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -4014,18 +3944,10 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onGroundOverlayTap was null.', - ); - final List args = (message as List?)!; - final String? arg_groundOverlayId = (args[0] as String?); - assert( - arg_groundOverlayId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.onGroundOverlayTap was null, expected non-null String.', - ); + final List args = message! as List; + final String arg_groundOverlayId = args[0]! as String; try { - api.onGroundOverlayTap(arg_groundOverlayId!); + api.onGroundOverlayTap(arg_groundOverlayId); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -4047,31 +3969,15 @@ abstract class MapsCallbackApi { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { - assert( - message != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.getTileOverlayTile was null.', - ); - final List args = (message as List?)!; - final String? arg_tileOverlayId = (args[0] as String?); - assert( - arg_tileOverlayId != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.getTileOverlayTile was null, expected non-null String.', - ); - final PlatformPoint? arg_location = (args[1] as PlatformPoint?); - assert( - arg_location != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.getTileOverlayTile was null, expected non-null PlatformPoint.', - ); - final int? arg_zoom = (args[2] as int?); - assert( - arg_zoom != null, - 'Argument for dev.flutter.pigeon.google_maps_flutter_android.MapsCallbackApi.getTileOverlayTile was null, expected non-null int.', - ); + final List args = message! as List; + final String arg_tileOverlayId = args[0]! as String; + final PlatformPoint arg_location = args[1]! as PlatformPoint; + final int arg_zoom = args[2]! as int; try { final PlatformTile output = await api.getTileOverlayTile( - arg_tileOverlayId!, - arg_location!, - arg_zoom!, + arg_tileOverlayId, + arg_location, + arg_zoom, ); return wrapResponse(result: output); } on PlatformException catch (e) { @@ -4125,22 +4031,13 @@ class MapsInitializerApi { [type], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as PlatformRendererType?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as PlatformRendererType; } /// Attempts to trigger any thread-blocking work @@ -4155,17 +4052,12 @@ class MapsInitializerApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } } @@ -4201,17 +4093,12 @@ class MapsPlatformViewApi { [type], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } } @@ -4243,22 +4130,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future areRotateGesturesEnabled() async { @@ -4271,22 +4149,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future areZoomControlsEnabled() async { @@ -4299,22 +4168,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future areScrollGesturesEnabled() async { @@ -4327,22 +4187,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future areTiltGesturesEnabled() async { @@ -4355,22 +4206,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future areZoomGesturesEnabled() async { @@ -4383,22 +4225,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future isCompassEnabled() async { @@ -4411,22 +4244,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future isLiteModeEnabled() async { @@ -4439,17 +4263,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as bool?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as bool?; } Future isMapToolbarEnabled() async { @@ -4462,22 +4282,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future isMyLocationButtonEnabled() async { @@ -4490,22 +4301,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future isTrafficEnabled() async { @@ -4518,22 +4320,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future getTileOverlayInfo(String tileOverlayId) async { @@ -4548,17 +4341,13 @@ class MapsInspectorApi { [tileOverlayId], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as PlatformTileLayer?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as PlatformTileLayer?; } Future getGroundOverlayInfo( @@ -4575,17 +4364,13 @@ class MapsInspectorApi { [groundOverlayId], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as PlatformGroundOverlay?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as PlatformGroundOverlay?; } Future getZoomRange() async { @@ -4598,22 +4383,13 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as PlatformZoomRange?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as PlatformZoomRange; } Future> getClusters(String clusterManagerId) async { @@ -4628,23 +4404,13 @@ class MapsInspectorApi { [clusterManagerId], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as List?)! - .cast(); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return (pigeonVar_replyValue! as List).cast(); } Future getCameraPosition() async { @@ -4657,21 +4423,12 @@ class MapsInspectorApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as PlatformCameraPosition?)!; - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as PlatformCameraPosition; } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart index 09ee66261f80..32d2ba809b6b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart @@ -7,9 +7,9 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/src/messages.g.dart', - javaOptions: JavaOptions(package: 'io.flutter.plugins.googlemaps'), - javaOut: - 'android/src/main/java/io/flutter/plugins/googlemaps/Messages.java', + kotlinOptions: KotlinOptions(package: 'io.flutter.plugins.googlemaps'), + kotlinOut: + 'android/src/main/kotlin/io/flutter/plugins/googlemaps/Messages.kt', copyrightHeader: 'pigeons/copyright.txt', ), ) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index dea5e50d236c..34459402058d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.19.6 +version: 2.19.8 environment: sdk: ^3.9.0 @@ -22,6 +22,7 @@ dependencies: sdk: flutter flutter_plugin_android_lifecycle: ^2.0.1 google_maps_flutter_platform_interface: ^2.13.0 + meta: ^1.10.0 stream_transform: ^2.0.0 dev_dependencies: @@ -30,7 +31,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^26.1.0 + pigeon: ^26.3.4 plugin_platform_interface: ^2.1.7 topics: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_marker_icons.dart index c6ac258e5999..5069f3f900af 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_marker_icons.dart @@ -12,12 +12,8 @@ import 'place_marker.dart'; /// Page that demonstrates how to use custom [AdvanceMarker] icons. class AdvancedMarkerIconsPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerIconsPage({Key? key, required this.mapId}) - : super( - key: key, - const Icon(Icons.image_outlined), - 'Advanced marker icons', - ); + const AdvancedMarkerIconsPage({super.key, required this.mapId}) + : super(const Icon(Icons.image_outlined), 'Advanced marker icons'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_markers_clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_markers_clustering.dart index a63ce58bef29..1787e9077a50 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_markers_clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/advanced_markers_clustering.dart @@ -15,9 +15,8 @@ import 'page.dart'; /// Same as [ClusteringPage] but works with [AdvancedMarker]. class AdvancedMarkersClusteringPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkersClusteringPage({Key? key, required this.mapId}) + const AdvancedMarkersClusteringPage({super.key, required this.mapId}) : super( - key: key, const Icon(Icons.place_outlined), 'Manage clusters of advanced markers', ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/animate_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/animate_camera.dart index a7c515c36928..001006fb54be 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/animate_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/animate_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class AnimateCameraPage extends GoogleMapExampleAppPage { - const AnimateCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control, animated', key: key); + const AnimateCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control, animated'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/clustering.dart index a97d3f225f05..18e9af8c1be8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/clustering.dart @@ -13,8 +13,8 @@ import 'page.dart'; /// Page for demonstrating marker clustering support. class ClusteringPage extends GoogleMapExampleAppPage { /// Default Constructor. - const ClusteringPage({Key? key}) - : super(const Icon(Icons.place), 'Manage clustering', key: key); + const ClusteringPage({super.key}) + : super(const Icon(Icons.place), 'Manage clustering'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/collision_behavior.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/collision_behavior.dart index 021d978a10ed..a6a8ef8aec70 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/collision_behavior.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/collision_behavior.dart @@ -14,11 +14,10 @@ import 'place_marker.dart'; /// Page demonstrating how to use AdvancedMarker's collision behavior. class AdvancedMarkerCollisionBehaviorPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerCollisionBehaviorPage({Key? key, required this.mapId}) + const AdvancedMarkerCollisionBehaviorPage({super.key, required this.mapId}) : super( const Icon(Icons.not_listed_location), 'Advanced marker collision behavior', - key: key, ); /// Map ID to use for the GoogleMap. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/ground_overlay.dart index d8f474eb7d5e..00a7d8126539 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/ground_overlay.dart @@ -13,8 +13,8 @@ import 'page.dart'; enum _GroundOverlayPlacing { position, bounds } class GroundOverlayPage extends GoogleMapExampleAppPage { - const GroundOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Ground overlay', key: key); + const GroundOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Ground overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/lite_mode.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/lite_mode.dart index e6359e19acc2..a68778c43842 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/lite_mode.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/lite_mode.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class LiteModePage extends GoogleMapExampleAppPage { - const LiteModePage({Key? key}) - : super(const Icon(Icons.map), 'Lite mode', key: key); + const LiteModePage({super.key}) : super(const Icon(Icons.map), 'Lite mode'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_click.dart index 4d45e961d63e..a786197d5205 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_click.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapClickPage extends GoogleMapExampleAppPage { - const MapClickPage({Key? key}) - : super(const Icon(Icons.mouse), 'Map click', key: key); + const MapClickPage({super.key}) : super(const Icon(Icons.mouse), 'Map click'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_coordinates.dart index 3a93b0db93b7..646301db99ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_coordinates.dart @@ -16,8 +16,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapCoordinatesPage extends GoogleMapExampleAppPage { - const MapCoordinatesPage({Key? key}) - : super(const Icon(Icons.map), 'Map coordinates', key: key); + const MapCoordinatesPage({super.key}) + : super(const Icon(Icons.map), 'Map coordinates'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_map_id.dart index c62152f149d0..94a01eb03368 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_map_id.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MapIdPage extends GoogleMapExampleAppPage { - const MapIdPage({Key? key}) - : super(const Icon(Icons.map), 'Cloud-based maps styling', key: key); + const MapIdPage({super.key}) + : super(const Icon(Icons.map), 'Cloud-based maps styling'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_ui.dart index 46fa320ad3a0..258c88170924 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/map_ui.dart @@ -17,8 +17,7 @@ final LatLngBounds sydneyBounds = LatLngBounds( ); class MapUiPage extends GoogleMapExampleAppPage { - const MapUiPage({Key? key}) - : super(const Icon(Icons.map), 'User interface', key: key); + const MapUiPage({super.key}) : super(const Icon(Icons.map), 'User interface'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/marker_icons.dart index 20663eda8282..d4ac8d6ac597 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/marker_icons.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MarkerIconsPage extends GoogleMapExampleAppPage { - const MarkerIconsPage({Key? key}) - : super(const Icon(Icons.image), 'Marker icons', key: key); + const MarkerIconsPage({super.key}) + : super(const Icon(Icons.image), 'Marker icons'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/move_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/move_camera.dart index bc6fcdea2651..5fc48e659246 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/move_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/move_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MoveCameraPage extends GoogleMapExampleAppPage { - const MoveCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control', key: key); + const MoveCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/padding.dart index beb39b305f58..a0f4f8521c8e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/padding.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PaddingPage extends GoogleMapExampleAppPage { - const PaddingPage({Key? key}) - : super(const Icon(Icons.map), 'Add padding to the map', key: key); + const PaddingPage({super.key}) + : super(const Icon(Icons.map), 'Add padding to the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_advanced_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_advanced_marker.dart index 9d35188ecf40..d835fa94fe5c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_advanced_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_advanced_marker.dart @@ -13,12 +13,8 @@ import 'page.dart'; /// Page demonstrating how to use Advanced [Marker] class. class PlaceAdvancedMarkerPage extends GoogleMapExampleAppPage { /// Default constructor. - const PlaceAdvancedMarkerPage({Key? key, required this.mapId}) - : super( - const Icon(Icons.place_outlined), - 'Place advanced marker', - key: key, - ); + const PlaceAdvancedMarkerPage({super.key, required this.mapId}) + : super(const Icon(Icons.place_outlined), 'Place advanced marker'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_circle.dart index 88c84c79e124..3c0335bfd18b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_circle.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceCirclePage extends GoogleMapExampleAppPage { - const PlaceCirclePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place circle', key: key); + const PlaceCirclePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place circle'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_marker.dart index 3feb922a84a6..77ba3787d8e7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_marker.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceMarkerPage extends GoogleMapExampleAppPage { - const PlaceMarkerPage({Key? key}) - : super(const Icon(Icons.place), 'Place marker', key: key); + const PlaceMarkerPage({super.key}) + : super(const Icon(Icons.place), 'Place marker'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polygon.dart index ff9eac82210c..70ad42c93724 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polygon.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolygonPage extends GoogleMapExampleAppPage { - const PlacePolygonPage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polygon', key: key); + const PlacePolygonPage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polygon'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polyline.dart index f749cac5f268..8703ffcbd68f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/place_polyline.dart @@ -12,8 +12,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolylinePage extends GoogleMapExampleAppPage { - const PlacePolylinePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polyline', key: key); + const PlacePolylinePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polyline'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/scrolling_map.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/scrolling_map.dart index 57d8cd6d9ff4..e5a8ec2ce5a6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/scrolling_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/scrolling_map.dart @@ -15,8 +15,8 @@ import 'page.dart'; const LatLng _center = LatLng(32.080664, 34.9563837); class ScrollingMapPage extends GoogleMapExampleAppPage { - const ScrollingMapPage({Key? key}) - : super(const Icon(Icons.map), 'Scrolling map', key: key); + const ScrollingMapPage({super.key}) + : super(const Icon(Icons.map), 'Scrolling map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/snapshot.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/snapshot.dart index 8fa4d67b6422..6f1624234ec4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/snapshot.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/snapshot.dart @@ -18,12 +18,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class SnapshotPage extends GoogleMapExampleAppPage { - const SnapshotPage({Key? key}) - : super( - const Icon(Icons.camera_alt), - 'Take a snapshot of the map', - key: key, - ); + const SnapshotPage({super.key}) + : super(const Icon(Icons.camera_alt), 'Take a snapshot of the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/tile_overlay.dart index bcce3b5f387b..cefa70eb34d5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/lib/tile_overlay.dart @@ -14,8 +14,8 @@ import 'example_google_map.dart'; import 'page.dart'; class TileOverlayPage extends GoogleMapExampleAppPage { - const TileOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Tile overlay', key: key); + const TileOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Tile overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_marker_icons.dart index c6ac258e5999..5069f3f900af 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_marker_icons.dart @@ -12,12 +12,8 @@ import 'place_marker.dart'; /// Page that demonstrates how to use custom [AdvanceMarker] icons. class AdvancedMarkerIconsPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerIconsPage({Key? key, required this.mapId}) - : super( - key: key, - const Icon(Icons.image_outlined), - 'Advanced marker icons', - ); + const AdvancedMarkerIconsPage({super.key, required this.mapId}) + : super(const Icon(Icons.image_outlined), 'Advanced marker icons'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_markers_clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_markers_clustering.dart index a63ce58bef29..1787e9077a50 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_markers_clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/advanced_markers_clustering.dart @@ -15,9 +15,8 @@ import 'page.dart'; /// Same as [ClusteringPage] but works with [AdvancedMarker]. class AdvancedMarkersClusteringPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkersClusteringPage({Key? key, required this.mapId}) + const AdvancedMarkersClusteringPage({super.key, required this.mapId}) : super( - key: key, const Icon(Icons.place_outlined), 'Manage clusters of advanced markers', ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/animate_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/animate_camera.dart index a7c515c36928..001006fb54be 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/animate_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/animate_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class AnimateCameraPage extends GoogleMapExampleAppPage { - const AnimateCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control, animated', key: key); + const AnimateCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control, animated'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/clustering.dart index a97d3f225f05..18e9af8c1be8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/clustering.dart @@ -13,8 +13,8 @@ import 'page.dart'; /// Page for demonstrating marker clustering support. class ClusteringPage extends GoogleMapExampleAppPage { /// Default Constructor. - const ClusteringPage({Key? key}) - : super(const Icon(Icons.place), 'Manage clustering', key: key); + const ClusteringPage({super.key}) + : super(const Icon(Icons.place), 'Manage clustering'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/collision_behavior.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/collision_behavior.dart index 021d978a10ed..a6a8ef8aec70 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/collision_behavior.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/collision_behavior.dart @@ -14,11 +14,10 @@ import 'place_marker.dart'; /// Page demonstrating how to use AdvancedMarker's collision behavior. class AdvancedMarkerCollisionBehaviorPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerCollisionBehaviorPage({Key? key, required this.mapId}) + const AdvancedMarkerCollisionBehaviorPage({super.key, required this.mapId}) : super( const Icon(Icons.not_listed_location), 'Advanced marker collision behavior', - key: key, ); /// Map ID to use for the GoogleMap. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/ground_overlay.dart index d8f474eb7d5e..00a7d8126539 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/ground_overlay.dart @@ -13,8 +13,8 @@ import 'page.dart'; enum _GroundOverlayPlacing { position, bounds } class GroundOverlayPage extends GoogleMapExampleAppPage { - const GroundOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Ground overlay', key: key); + const GroundOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Ground overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/lite_mode.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/lite_mode.dart index e6359e19acc2..a68778c43842 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/lite_mode.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/lite_mode.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class LiteModePage extends GoogleMapExampleAppPage { - const LiteModePage({Key? key}) - : super(const Icon(Icons.map), 'Lite mode', key: key); + const LiteModePage({super.key}) : super(const Icon(Icons.map), 'Lite mode'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_click.dart index 4d45e961d63e..a786197d5205 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_click.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapClickPage extends GoogleMapExampleAppPage { - const MapClickPage({Key? key}) - : super(const Icon(Icons.mouse), 'Map click', key: key); + const MapClickPage({super.key}) : super(const Icon(Icons.mouse), 'Map click'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_coordinates.dart index 3a93b0db93b7..646301db99ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_coordinates.dart @@ -16,8 +16,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapCoordinatesPage extends GoogleMapExampleAppPage { - const MapCoordinatesPage({Key? key}) - : super(const Icon(Icons.map), 'Map coordinates', key: key); + const MapCoordinatesPage({super.key}) + : super(const Icon(Icons.map), 'Map coordinates'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_map_id.dart index c62152f149d0..94a01eb03368 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_map_id.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MapIdPage extends GoogleMapExampleAppPage { - const MapIdPage({Key? key}) - : super(const Icon(Icons.map), 'Cloud-based maps styling', key: key); + const MapIdPage({super.key}) + : super(const Icon(Icons.map), 'Cloud-based maps styling'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_ui.dart index 46fa320ad3a0..258c88170924 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/map_ui.dart @@ -17,8 +17,7 @@ final LatLngBounds sydneyBounds = LatLngBounds( ); class MapUiPage extends GoogleMapExampleAppPage { - const MapUiPage({Key? key}) - : super(const Icon(Icons.map), 'User interface', key: key); + const MapUiPage({super.key}) : super(const Icon(Icons.map), 'User interface'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/marker_icons.dart index 20663eda8282..d4ac8d6ac597 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/marker_icons.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MarkerIconsPage extends GoogleMapExampleAppPage { - const MarkerIconsPage({Key? key}) - : super(const Icon(Icons.image), 'Marker icons', key: key); + const MarkerIconsPage({super.key}) + : super(const Icon(Icons.image), 'Marker icons'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/move_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/move_camera.dart index bc6fcdea2651..5fc48e659246 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/move_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/move_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MoveCameraPage extends GoogleMapExampleAppPage { - const MoveCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control', key: key); + const MoveCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/padding.dart index beb39b305f58..a0f4f8521c8e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/padding.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PaddingPage extends GoogleMapExampleAppPage { - const PaddingPage({Key? key}) - : super(const Icon(Icons.map), 'Add padding to the map', key: key); + const PaddingPage({super.key}) + : super(const Icon(Icons.map), 'Add padding to the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_advanced_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_advanced_marker.dart index 9d35188ecf40..d835fa94fe5c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_advanced_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_advanced_marker.dart @@ -13,12 +13,8 @@ import 'page.dart'; /// Page demonstrating how to use Advanced [Marker] class. class PlaceAdvancedMarkerPage extends GoogleMapExampleAppPage { /// Default constructor. - const PlaceAdvancedMarkerPage({Key? key, required this.mapId}) - : super( - const Icon(Icons.place_outlined), - 'Place advanced marker', - key: key, - ); + const PlaceAdvancedMarkerPage({super.key, required this.mapId}) + : super(const Icon(Icons.place_outlined), 'Place advanced marker'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_circle.dart index 88c84c79e124..3c0335bfd18b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_circle.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceCirclePage extends GoogleMapExampleAppPage { - const PlaceCirclePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place circle', key: key); + const PlaceCirclePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place circle'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_marker.dart index 3feb922a84a6..77ba3787d8e7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_marker.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceMarkerPage extends GoogleMapExampleAppPage { - const PlaceMarkerPage({Key? key}) - : super(const Icon(Icons.place), 'Place marker', key: key); + const PlaceMarkerPage({super.key}) + : super(const Icon(Icons.place), 'Place marker'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polygon.dart index ff9eac82210c..70ad42c93724 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polygon.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolygonPage extends GoogleMapExampleAppPage { - const PlacePolygonPage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polygon', key: key); + const PlacePolygonPage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polygon'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polyline.dart index f749cac5f268..8703ffcbd68f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/place_polyline.dart @@ -12,8 +12,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolylinePage extends GoogleMapExampleAppPage { - const PlacePolylinePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polyline', key: key); + const PlacePolylinePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polyline'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/scrolling_map.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/scrolling_map.dart index 57d8cd6d9ff4..e5a8ec2ce5a6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/scrolling_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/scrolling_map.dart @@ -15,8 +15,8 @@ import 'page.dart'; const LatLng _center = LatLng(32.080664, 34.9563837); class ScrollingMapPage extends GoogleMapExampleAppPage { - const ScrollingMapPage({Key? key}) - : super(const Icon(Icons.map), 'Scrolling map', key: key); + const ScrollingMapPage({super.key}) + : super(const Icon(Icons.map), 'Scrolling map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/snapshot.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/snapshot.dart index 8fa4d67b6422..6f1624234ec4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/snapshot.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/snapshot.dart @@ -18,12 +18,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class SnapshotPage extends GoogleMapExampleAppPage { - const SnapshotPage({Key? key}) - : super( - const Icon(Icons.camera_alt), - 'Take a snapshot of the map', - key: key, - ); + const SnapshotPage({super.key}) + : super(const Icon(Icons.camera_alt), 'Take a snapshot of the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/tile_overlay.dart index bcce3b5f387b..cefa70eb34d5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/example/lib/tile_overlay.dart @@ -14,8 +14,8 @@ import 'example_google_map.dart'; import 'page.dart'; class TileOverlayPage extends GoogleMapExampleAppPage { - const TileOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Tile overlay', key: key); + const TileOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Tile overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_marker_icons.dart index c6ac258e5999..5069f3f900af 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_marker_icons.dart @@ -12,12 +12,8 @@ import 'place_marker.dart'; /// Page that demonstrates how to use custom [AdvanceMarker] icons. class AdvancedMarkerIconsPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerIconsPage({Key? key, required this.mapId}) - : super( - key: key, - const Icon(Icons.image_outlined), - 'Advanced marker icons', - ); + const AdvancedMarkerIconsPage({super.key, required this.mapId}) + : super(const Icon(Icons.image_outlined), 'Advanced marker icons'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_markers_clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_markers_clustering.dart index a63ce58bef29..1787e9077a50 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_markers_clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/advanced_markers_clustering.dart @@ -15,9 +15,8 @@ import 'page.dart'; /// Same as [ClusteringPage] but works with [AdvancedMarker]. class AdvancedMarkersClusteringPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkersClusteringPage({Key? key, required this.mapId}) + const AdvancedMarkersClusteringPage({super.key, required this.mapId}) : super( - key: key, const Icon(Icons.place_outlined), 'Manage clusters of advanced markers', ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/animate_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/animate_camera.dart index a7c515c36928..001006fb54be 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/animate_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/animate_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class AnimateCameraPage extends GoogleMapExampleAppPage { - const AnimateCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control, animated', key: key); + const AnimateCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control, animated'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/clustering.dart index a97d3f225f05..18e9af8c1be8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/clustering.dart @@ -13,8 +13,8 @@ import 'page.dart'; /// Page for demonstrating marker clustering support. class ClusteringPage extends GoogleMapExampleAppPage { /// Default Constructor. - const ClusteringPage({Key? key}) - : super(const Icon(Icons.place), 'Manage clustering', key: key); + const ClusteringPage({super.key}) + : super(const Icon(Icons.place), 'Manage clustering'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/collision_behavior.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/collision_behavior.dart index 021d978a10ed..a6a8ef8aec70 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/collision_behavior.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/collision_behavior.dart @@ -14,11 +14,10 @@ import 'place_marker.dart'; /// Page demonstrating how to use AdvancedMarker's collision behavior. class AdvancedMarkerCollisionBehaviorPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerCollisionBehaviorPage({Key? key, required this.mapId}) + const AdvancedMarkerCollisionBehaviorPage({super.key, required this.mapId}) : super( const Icon(Icons.not_listed_location), 'Advanced marker collision behavior', - key: key, ); /// Map ID to use for the GoogleMap. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/ground_overlay.dart index d8f474eb7d5e..00a7d8126539 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/ground_overlay.dart @@ -13,8 +13,8 @@ import 'page.dart'; enum _GroundOverlayPlacing { position, bounds } class GroundOverlayPage extends GoogleMapExampleAppPage { - const GroundOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Ground overlay', key: key); + const GroundOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Ground overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/lite_mode.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/lite_mode.dart index e6359e19acc2..a68778c43842 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/lite_mode.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/lite_mode.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class LiteModePage extends GoogleMapExampleAppPage { - const LiteModePage({Key? key}) - : super(const Icon(Icons.map), 'Lite mode', key: key); + const LiteModePage({super.key}) : super(const Icon(Icons.map), 'Lite mode'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_click.dart index 4d45e961d63e..a786197d5205 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_click.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapClickPage extends GoogleMapExampleAppPage { - const MapClickPage({Key? key}) - : super(const Icon(Icons.mouse), 'Map click', key: key); + const MapClickPage({super.key}) : super(const Icon(Icons.mouse), 'Map click'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_coordinates.dart index 3a93b0db93b7..646301db99ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_coordinates.dart @@ -16,8 +16,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapCoordinatesPage extends GoogleMapExampleAppPage { - const MapCoordinatesPage({Key? key}) - : super(const Icon(Icons.map), 'Map coordinates', key: key); + const MapCoordinatesPage({super.key}) + : super(const Icon(Icons.map), 'Map coordinates'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_map_id.dart index c62152f149d0..94a01eb03368 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_map_id.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MapIdPage extends GoogleMapExampleAppPage { - const MapIdPage({Key? key}) - : super(const Icon(Icons.map), 'Cloud-based maps styling', key: key); + const MapIdPage({super.key}) + : super(const Icon(Icons.map), 'Cloud-based maps styling'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_ui.dart index 46fa320ad3a0..258c88170924 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/map_ui.dart @@ -17,8 +17,7 @@ final LatLngBounds sydneyBounds = LatLngBounds( ); class MapUiPage extends GoogleMapExampleAppPage { - const MapUiPage({Key? key}) - : super(const Icon(Icons.map), 'User interface', key: key); + const MapUiPage({super.key}) : super(const Icon(Icons.map), 'User interface'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/marker_icons.dart index 20663eda8282..d4ac8d6ac597 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/marker_icons.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MarkerIconsPage extends GoogleMapExampleAppPage { - const MarkerIconsPage({Key? key}) - : super(const Icon(Icons.image), 'Marker icons', key: key); + const MarkerIconsPage({super.key}) + : super(const Icon(Icons.image), 'Marker icons'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/move_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/move_camera.dart index bc6fcdea2651..5fc48e659246 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/move_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/move_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MoveCameraPage extends GoogleMapExampleAppPage { - const MoveCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control', key: key); + const MoveCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/padding.dart index beb39b305f58..a0f4f8521c8e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/padding.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PaddingPage extends GoogleMapExampleAppPage { - const PaddingPage({Key? key}) - : super(const Icon(Icons.map), 'Add padding to the map', key: key); + const PaddingPage({super.key}) + : super(const Icon(Icons.map), 'Add padding to the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_advanced_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_advanced_marker.dart index 9d35188ecf40..d835fa94fe5c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_advanced_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_advanced_marker.dart @@ -13,12 +13,8 @@ import 'page.dart'; /// Page demonstrating how to use Advanced [Marker] class. class PlaceAdvancedMarkerPage extends GoogleMapExampleAppPage { /// Default constructor. - const PlaceAdvancedMarkerPage({Key? key, required this.mapId}) - : super( - const Icon(Icons.place_outlined), - 'Place advanced marker', - key: key, - ); + const PlaceAdvancedMarkerPage({super.key, required this.mapId}) + : super(const Icon(Icons.place_outlined), 'Place advanced marker'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_circle.dart index 88c84c79e124..3c0335bfd18b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_circle.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceCirclePage extends GoogleMapExampleAppPage { - const PlaceCirclePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place circle', key: key); + const PlaceCirclePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place circle'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_marker.dart index 3feb922a84a6..77ba3787d8e7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_marker.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceMarkerPage extends GoogleMapExampleAppPage { - const PlaceMarkerPage({Key? key}) - : super(const Icon(Icons.place), 'Place marker', key: key); + const PlaceMarkerPage({super.key}) + : super(const Icon(Icons.place), 'Place marker'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polygon.dart index ff9eac82210c..70ad42c93724 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polygon.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolygonPage extends GoogleMapExampleAppPage { - const PlacePolygonPage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polygon', key: key); + const PlacePolygonPage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polygon'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polyline.dart index f749cac5f268..8703ffcbd68f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/place_polyline.dart @@ -12,8 +12,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolylinePage extends GoogleMapExampleAppPage { - const PlacePolylinePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polyline', key: key); + const PlacePolylinePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polyline'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/scrolling_map.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/scrolling_map.dart index 57d8cd6d9ff4..e5a8ec2ce5a6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/scrolling_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/scrolling_map.dart @@ -15,8 +15,8 @@ import 'page.dart'; const LatLng _center = LatLng(32.080664, 34.9563837); class ScrollingMapPage extends GoogleMapExampleAppPage { - const ScrollingMapPage({Key? key}) - : super(const Icon(Icons.map), 'Scrolling map', key: key); + const ScrollingMapPage({super.key}) + : super(const Icon(Icons.map), 'Scrolling map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/snapshot.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/snapshot.dart index 8fa4d67b6422..6f1624234ec4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/snapshot.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/snapshot.dart @@ -18,12 +18,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class SnapshotPage extends GoogleMapExampleAppPage { - const SnapshotPage({Key? key}) - : super( - const Icon(Icons.camera_alt), - 'Take a snapshot of the map', - key: key, - ); + const SnapshotPage({super.key}) + : super(const Icon(Icons.camera_alt), 'Take a snapshot of the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/tile_overlay.dart index bcce3b5f387b..cefa70eb34d5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/example/lib/tile_overlay.dart @@ -14,8 +14,8 @@ import 'example_google_map.dart'; import 'page.dart'; class TileOverlayPage extends GoogleMapExampleAppPage { - const TileOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Tile overlay', key: key); + const TileOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Tile overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_marker_icons.dart index c6ac258e5999..5069f3f900af 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_marker_icons.dart @@ -12,12 +12,8 @@ import 'place_marker.dart'; /// Page that demonstrates how to use custom [AdvanceMarker] icons. class AdvancedMarkerIconsPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerIconsPage({Key? key, required this.mapId}) - : super( - key: key, - const Icon(Icons.image_outlined), - 'Advanced marker icons', - ); + const AdvancedMarkerIconsPage({super.key, required this.mapId}) + : super(const Icon(Icons.image_outlined), 'Advanced marker icons'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_markers_clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_markers_clustering.dart index a63ce58bef29..1787e9077a50 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_markers_clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/advanced_markers_clustering.dart @@ -15,9 +15,8 @@ import 'page.dart'; /// Same as [ClusteringPage] but works with [AdvancedMarker]. class AdvancedMarkersClusteringPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkersClusteringPage({Key? key, required this.mapId}) + const AdvancedMarkersClusteringPage({super.key, required this.mapId}) : super( - key: key, const Icon(Icons.place_outlined), 'Manage clusters of advanced markers', ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/animate_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/animate_camera.dart index a7c515c36928..001006fb54be 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/animate_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/animate_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class AnimateCameraPage extends GoogleMapExampleAppPage { - const AnimateCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control, animated', key: key); + const AnimateCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control, animated'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/clustering.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/clustering.dart index a97d3f225f05..18e9af8c1be8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/clustering.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/clustering.dart @@ -13,8 +13,8 @@ import 'page.dart'; /// Page for demonstrating marker clustering support. class ClusteringPage extends GoogleMapExampleAppPage { /// Default Constructor. - const ClusteringPage({Key? key}) - : super(const Icon(Icons.place), 'Manage clustering', key: key); + const ClusteringPage({super.key}) + : super(const Icon(Icons.place), 'Manage clustering'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/collision_behavior.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/collision_behavior.dart index 021d978a10ed..a6a8ef8aec70 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/collision_behavior.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/collision_behavior.dart @@ -14,11 +14,10 @@ import 'place_marker.dart'; /// Page demonstrating how to use AdvancedMarker's collision behavior. class AdvancedMarkerCollisionBehaviorPage extends GoogleMapExampleAppPage { /// Default constructor. - const AdvancedMarkerCollisionBehaviorPage({Key? key, required this.mapId}) + const AdvancedMarkerCollisionBehaviorPage({super.key, required this.mapId}) : super( const Icon(Icons.not_listed_location), 'Advanced marker collision behavior', - key: key, ); /// Map ID to use for the GoogleMap. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/ground_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/ground_overlay.dart index d8f474eb7d5e..00a7d8126539 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/ground_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/ground_overlay.dart @@ -13,8 +13,8 @@ import 'page.dart'; enum _GroundOverlayPlacing { position, bounds } class GroundOverlayPage extends GoogleMapExampleAppPage { - const GroundOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Ground overlay', key: key); + const GroundOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Ground overlay'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/lite_mode.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/lite_mode.dart index e6359e19acc2..a68778c43842 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/lite_mode.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/lite_mode.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class LiteModePage extends GoogleMapExampleAppPage { - const LiteModePage({Key? key}) - : super(const Icon(Icons.map), 'Lite mode', key: key); + const LiteModePage({super.key}) : super(const Icon(Icons.map), 'Lite mode'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_click.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_click.dart index 4d45e961d63e..a786197d5205 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_click.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_click.dart @@ -16,8 +16,7 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapClickPage extends GoogleMapExampleAppPage { - const MapClickPage({Key? key}) - : super(const Icon(Icons.mouse), 'Map click', key: key); + const MapClickPage({super.key}) : super(const Icon(Icons.mouse), 'Map click'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_coordinates.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_coordinates.dart index 3a93b0db93b7..646301db99ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_coordinates.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_coordinates.dart @@ -16,8 +16,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class MapCoordinatesPage extends GoogleMapExampleAppPage { - const MapCoordinatesPage({Key? key}) - : super(const Icon(Icons.map), 'Map coordinates', key: key); + const MapCoordinatesPage({super.key}) + : super(const Icon(Icons.map), 'Map coordinates'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_map_id.dart index c62152f149d0..94a01eb03368 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_map_id.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MapIdPage extends GoogleMapExampleAppPage { - const MapIdPage({Key? key}) - : super(const Icon(Icons.map), 'Cloud-based maps styling', key: key); + const MapIdPage({super.key}) + : super(const Icon(Icons.map), 'Cloud-based maps styling'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_ui.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_ui.dart index 46fa320ad3a0..258c88170924 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_ui.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/map_ui.dart @@ -17,8 +17,7 @@ final LatLngBounds sydneyBounds = LatLngBounds( ); class MapUiPage extends GoogleMapExampleAppPage { - const MapUiPage({Key? key}) - : super(const Icon(Icons.map), 'User interface', key: key); + const MapUiPage({super.key}) : super(const Icon(Icons.map), 'User interface'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/marker_icons.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/marker_icons.dart index 20663eda8282..d4ac8d6ac597 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/marker_icons.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/marker_icons.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MarkerIconsPage extends GoogleMapExampleAppPage { - const MarkerIconsPage({Key? key}) - : super(const Icon(Icons.image), 'Marker icons', key: key); + const MarkerIconsPage({super.key}) + : super(const Icon(Icons.image), 'Marker icons'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/move_camera.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/move_camera.dart index bc6fcdea2651..5fc48e659246 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/move_camera.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/move_camera.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class MoveCameraPage extends GoogleMapExampleAppPage { - const MoveCameraPage({Key? key}) - : super(const Icon(Icons.map), 'Camera control', key: key); + const MoveCameraPage({super.key}) + : super(const Icon(Icons.map), 'Camera control'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/padding.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/padding.dart index beb39b305f58..a0f4f8521c8e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/padding.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/padding.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PaddingPage extends GoogleMapExampleAppPage { - const PaddingPage({Key? key}) - : super(const Icon(Icons.map), 'Add padding to the map', key: key); + const PaddingPage({super.key}) + : super(const Icon(Icons.map), 'Add padding to the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_advanced_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_advanced_marker.dart index 9d35188ecf40..d835fa94fe5c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_advanced_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_advanced_marker.dart @@ -13,12 +13,8 @@ import 'page.dart'; /// Page demonstrating how to use Advanced [Marker] class. class PlaceAdvancedMarkerPage extends GoogleMapExampleAppPage { /// Default constructor. - const PlaceAdvancedMarkerPage({Key? key, required this.mapId}) - : super( - const Icon(Icons.place_outlined), - 'Place advanced marker', - key: key, - ); + const PlaceAdvancedMarkerPage({super.key, required this.mapId}) + : super(const Icon(Icons.place_outlined), 'Place advanced marker'); /// Map ID to use for the GoogleMap. final String? mapId; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_circle.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_circle.dart index 88c84c79e124..3c0335bfd18b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_circle.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceCirclePage extends GoogleMapExampleAppPage { - const PlaceCirclePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place circle', key: key); + const PlaceCirclePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place circle'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_marker.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_marker.dart index 3feb922a84a6..77ba3787d8e7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_marker.dart @@ -16,8 +16,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlaceMarkerPage extends GoogleMapExampleAppPage { - const PlaceMarkerPage({Key? key}) - : super(const Icon(Icons.place), 'Place marker', key: key); + const PlaceMarkerPage({super.key}) + : super(const Icon(Icons.place), 'Place marker'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polygon.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polygon.dart index ff9eac82210c..70ad42c93724 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polygon.dart @@ -11,8 +11,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolygonPage extends GoogleMapExampleAppPage { - const PlacePolygonPage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polygon', key: key); + const PlacePolygonPage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polygon'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polyline.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polyline.dart index f749cac5f268..8703ffcbd68f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/place_polyline.dart @@ -12,8 +12,8 @@ import 'example_google_map.dart'; import 'page.dart'; class PlacePolylinePage extends GoogleMapExampleAppPage { - const PlacePolylinePage({Key? key}) - : super(const Icon(Icons.linear_scale), 'Place polyline', key: key); + const PlacePolylinePage({super.key}) + : super(const Icon(Icons.linear_scale), 'Place polyline'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/scrolling_map.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/scrolling_map.dart index 57d8cd6d9ff4..e5a8ec2ce5a6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/scrolling_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/scrolling_map.dart @@ -15,8 +15,8 @@ import 'page.dart'; const LatLng _center = LatLng(32.080664, 34.9563837); class ScrollingMapPage extends GoogleMapExampleAppPage { - const ScrollingMapPage({Key? key}) - : super(const Icon(Icons.map), 'Scrolling map', key: key); + const ScrollingMapPage({super.key}) + : super(const Icon(Icons.map), 'Scrolling map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/snapshot.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/snapshot.dart index 8fa4d67b6422..6f1624234ec4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/snapshot.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/snapshot.dart @@ -18,12 +18,8 @@ const CameraPosition _kInitialPosition = CameraPosition( ); class SnapshotPage extends GoogleMapExampleAppPage { - const SnapshotPage({Key? key}) - : super( - const Icon(Icons.camera_alt), - 'Take a snapshot of the map', - key: key, - ); + const SnapshotPage({super.key}) + : super(const Icon(Icons.camera_alt), 'Take a snapshot of the map'); @override Widget build(BuildContext context) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/tile_overlay.dart b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/tile_overlay.dart index bcce3b5f387b..cefa70eb34d5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/tile_overlay.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios_shared_code/example/lib/tile_overlay.dart @@ -14,8 +14,8 @@ import 'example_google_map.dart'; import 'page.dart'; class TileOverlayPage extends GoogleMapExampleAppPage { - const TileOverlayPage({Key? key}) - : super(const Icon(Icons.map), 'Tile overlay', key: key); + const TileOverlayPage({super.key}) + : super(const Icon(Icons.map), 'Tile overlay'); @override Widget build(BuildContext context) { diff --git a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/FileUtils.java b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/FileUtils.java index c19c4bbb6e05..d83f6fe7ec23 100644 --- a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/FileUtils.java +++ b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/FileUtils.java @@ -64,8 +64,8 @@ String getPathFromUri(final Context context, final Uri uri) { String uuid = UUID.randomUUID().toString(); File targetDirectory = new File(context.getCacheDir(), uuid); targetDirectory.mkdir(); - // TODO(SynSzakala) according to the docs, `deleteOnExit` does not work reliably on Android; we should preferably - // just clear the picked files after the app startup. + // TODO(SynSzakala) according to the docs, `deleteOnExit` does not work reliably on Android; + // we should preferably just clear the picked files after the app startup. targetDirectory.deleteOnExit(); String fileName = getImageName(context, uri); String extension = getImageExtension(context, uri); @@ -102,7 +102,9 @@ String getPathFromUri(final Context context, final Uri uri) { } } - /** @return extension of image with dot, or null if it's empty. */ + /** + * @return extension of image with dot, or null if it's empty. + */ private static String getImageExtension(Context context, Uri uriImage) { String extension; @@ -126,7 +128,8 @@ private static String getImageExtension(Context context, Uri uriImage) { return "." + sanitizeFilename(extension); } - // From https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#sanitize-provided-filenames. + // From + // https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#sanitize-provided-filenames. protected static @Nullable String sanitizeFilename(@Nullable String displayName) { if (displayName == null) { return null; @@ -160,7 +163,9 @@ private static String getImageExtension(Context context, Uri uriImage) { return f; } - /** @return name of the image provided by ContentResolver; this may be null. */ + /** + * @return name of the image provided by ContentResolver; this may be null. + */ private static String getImageName(Context context, Uri uriImage) { try (Cursor cursor = queryImageName(context, uriImage)) { if (cursor == null || !cursor.moveToFirst() || cursor.getColumnCount() < 1) return null; diff --git a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImageResizer.java b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImageResizer.java index 0b8299ba163d..0aa5bfbd4fda 100644 --- a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImageResizer.java +++ b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImageResizer.java @@ -182,7 +182,8 @@ private File createImageOnExternalDirectory(String name, Bitmap bitmap, int imag if (saveAsPNG) { Log.d( "ImageResizer", - "image_picker: compressing is not supported for type PNG. Returning the image with original quality"); + "image_picker: compressing is not supported for type PNG. Returning the image with" + + " original quality"); } bitmap.compress( saveAsPNG ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, diff --git a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java index bf582fa4d35b..9221e7d02809 100644 --- a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java +++ b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java @@ -870,6 +870,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -878,6 +879,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -886,6 +888,7 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImagePickerApi { /** Selects images and returns their paths. */ @@ -894,17 +897,20 @@ void pickImages( @NonNull ImageSelectionOptions options, @NonNull GeneralOptions generalOptions, @NonNull Result> result); + /** Selects video and returns their paths. */ void pickVideos( @NonNull SourceSpecification source, @NonNull VideoSelectionOptions options, @NonNull GeneralOptions generalOptions, @NonNull Result> result); + /** Selects images and videos and returns their paths. */ void pickMedia( @NonNull MediaSelectionOptions mediaSelectionOptions, @NonNull GeneralOptions generalOptions, @NonNull Result> result); + /** Returns results from a previous app session, if any. */ @Nullable CacheRetrievalResult retrieveLostResults(); @@ -913,6 +919,7 @@ void pickMedia( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Sets up an instance of `ImagePickerApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable ImagePickerApi api) { setUp(binaryMessenger, "", api); diff --git a/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/FileUtilTest.java b/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/FileUtilTest.java index 6d5336a75d8d..c0007be4ede6 100644 --- a/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/FileUtilTest.java +++ b/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/FileUtilTest.java @@ -217,7 +217,8 @@ public int update( // Mocks a malicious content provider attempting to use path indirection to modify files outside // of the intended directory. - // See https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#don%27t-trust-user-input. + // See + // https://developer.android.com/privacy-and-security/risks/untrustworthy-contentprovider-provided-filename#don%27t-trust-user-input. private static class MockMaliciousContentProvider extends ContentProvider { public static String PNG_URI = "content://dummy/a.png"; diff --git a/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImageResizerTest.java b/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImageResizerTest.java index f34f3e03b8b5..772c3981b4fe 100644 --- a/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImageResizerTest.java +++ b/packages/image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImageResizerTest.java @@ -33,7 +33,8 @@ import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; -// RobolectricTestRunner always creates a default mock bitmap when reading from file. So we cannot actually test the scaling. +// RobolectricTestRunner always creates a default mock bitmap when reading from file. So we cannot +// actually test the scaling. // But we can still test whether the original or scaled file is created. @RunWith(RobolectricTestRunner.class) public class ImageResizerTest { diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/InAppPurchasePlugin.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/InAppPurchasePlugin.java index 40038b0df832..ccb6bacdbb32 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/InAppPurchasePlugin.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/InAppPurchasePlugin.java @@ -19,8 +19,8 @@ public class InAppPurchasePlugin implements FlutterPlugin, ActivityAware { static final String PROXY_PACKAGE_KEY = "PROXY_PACKAGE"; // The proxy value has to match the value in library's AndroidManifest.xml. // This is important that the is not changed, so we hard code the value here then having - // a unit test to make sure. If there is a strong reason to change the value, please inform the - // code owner of this package. + // a unit test to make sure. If there is a strong reason to change the value, + // please inform the code owner of this package. static final String PROXY_VALUE = "io.flutter.plugins.inapppurchase"; private MethodCallHandlerImpl methodCallHandler; @@ -61,7 +61,7 @@ private void setUpMethodChannel(BinaryMessenger messenger, Context context) { Messages.InAppPurchaseCallbackApi handler = new Messages.InAppPurchaseCallbackApi(messenger); methodCallHandler = new MethodCallHandlerImpl( - /*activity=*/ null, context, handler, new BillingClientFactoryImpl()); + /* activity= */ null, context, handler, new BillingClientFactoryImpl()); Messages.InAppPurchaseApi.setUp(messenger, methodCallHandler); } diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java index fa1135fed036..5a9191c4e860 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java @@ -3304,6 +3304,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -3312,6 +3313,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -3320,39 +3322,48 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ @NonNull Boolean isReady(); + /** Wraps BillingClient#startConnection(BillingClientStateListener). */ void startConnection( @NonNull Long callbackHandle, @NonNull PlatformBillingChoiceMode billingMode, @NonNull PlatformPendingPurchasesParams pendingPurchasesParams, @NonNull Result result); + /** Wraps BillingClient#endConnection(BillingClientStateListener). */ void endConnection(); + /** * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, * BillingConfigResponseListener). */ void getBillingConfigAsync(@NonNull Result result); + /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ @NonNull PlatformBillingResult launchBillingFlow(@NonNull PlatformBillingFlowParams params); + /** * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, * AcknowledgePurchaseResponseListener). */ void acknowledgePurchase( @NonNull String purchaseToken, @NonNull Result result); + /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ void consumeAsync(@NonNull String purchaseToken, @NonNull Result result); + /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ void queryPurchasesAsync( @NonNull PlatformProductType productType, @NonNull Result result); + /** * Wraps BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, * PurchaseHistoryResponseListener). @@ -3360,6 +3371,7 @@ void queryPurchasesAsync( void queryPurchaseHistoryAsync( @NonNull PlatformProductType productType, @NonNull Result result); + /** * Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, * ProductDetailsResponseListener). @@ -3367,13 +3379,17 @@ void queryPurchaseHistoryAsync( void queryProductDetailsAsync( @NonNull List products, @NonNull Result result); + /** Wraps BillingClient#isFeatureSupported(String). */ @NonNull Boolean isFeatureSupported(@NonNull PlatformBillingClientFeature feature); + /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ void isAlternativeBillingOnlyAvailableAsync(@NonNull Result result); + /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ void showAlternativeBillingOnlyInformationDialog(@NonNull Result result); + /** * Wraps * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). @@ -3385,6 +3401,7 @@ void createAlternativeBillingOnlyReportingDetailsAsync( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ @@ -3813,6 +3830,7 @@ public void error(Throwable error) { } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class InAppPurchaseCallbackApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -3832,6 +3850,7 @@ public InAppPurchaseCallbackApi( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Called for BillingClientStateListener#onBillingServiceDisconnected(). */ public void onBillingServiceDisconnected( @NonNull Long callbackHandleArg, @NonNull VoidResult result) { @@ -3857,6 +3876,7 @@ public void onBillingServiceDisconnected( } }); } + /** Called for PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List). */ public void onPurchasesUpdated( @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { @@ -3882,6 +3902,7 @@ public void onPurchasesUpdated( } }); } + /** Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). */ public void userSelectedalternativeBilling( @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java index d496fb57b323..fe9a0cb1016f 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java @@ -255,7 +255,9 @@ public void queryProductDetailsAsync( "NOT_FOUND", "Details for product " + params.getProduct() - + " are not available. It might because products were not fetched prior to the call. Please fetch the products first. An example of how to fetch the products could be found here: " + + " are not available. It might because products were not fetched prior to the call." + + " Please fetch the products first. An example of how to fetch the products could be" + + " found here: " + LOAD_PRODUCT_DOC_URL, null); } @@ -279,7 +281,9 @@ public void queryProductDetailsAsync( + params.getOfferToken() + " for product " + params.getProduct() - + " is not valid. Make sure to only pass offer tokens that belong to the product. To obtain offer tokens for a product, fetch the products. An example of how to fetch the products could be found here: " + + " is not valid. Make sure to only pass offer tokens that belong to the product." + + " To obtain offer tokens for a product, fetch the products. An example of how to" + + " fetch the products could be found here: " + LOAD_PRODUCT_DOC_URL, null); } @@ -290,7 +294,8 @@ public void queryProductDetailsAsync( != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY)) { throw new FlutterError( "IN_APP_PURCHASE_REQUIRE_OLD_PRODUCT", - "launchBillingFlow failed because oldProduct is null. You must provide a valid oldProduct in order to use a replacement mode.", + "launchBillingFlow failed because oldProduct is null. You must provide a valid oldProduct" + + " in order to use a replacement mode.", null); } else if (params.getOldProduct() != null && !cachedProducts.containsKey(params.getOldProduct())) { @@ -298,7 +303,9 @@ public void queryProductDetailsAsync( "IN_APP_PURCHASE_INVALID_OLD_PRODUCT", "Details for product " + params.getOldProduct() - + " are not available. It might because products were not fetched prior to the call. Please fetch the products first. An example of how to fetch the products could be found here: " + + " are not available. It might because products were not fetched prior to the call." + + " Please fetch the products first. An example of how to fetch the products could be" + + " found here: " + LOAD_PRODUCT_DOC_URL, null); } diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java index a982964764dc..cba877cdc184 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java @@ -95,7 +95,7 @@ static PlatformProductType toPlatformProductType(@NonNull String typeString) { switch (typeString) { case BillingClient.ProductType.INAPP: - // Fallback handling to avoid throwing an exception if a new type is added in the future. + // Fallback handling to avoid throwing an exception if a new type is added in the future. default: return PlatformProductType.INAPP; case BillingClient.ProductType.SUBS: diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/InAppPurchasePluginTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/InAppPurchasePluginTest.java index 2e5fe6154abd..80a1018a96c9 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/InAppPurchasePluginTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/InAppPurchasePluginTest.java @@ -49,19 +49,26 @@ public void tearDown() throws Exception { mockCloseable.close(); } - // The PROXY_PACKAGE_KEY value of this test (io.flutter.plugins.inapppurchase) should never be changed. - // In case there's a strong reason to change it, please inform the current code owner of the plugin. + // The PROXY_PACKAGE_KEY value of this test (io.flutter.plugins.inapppurchase) should never be + // changed. + // In case there's a strong reason to change it, please inform the current code owner of the + // plugin. @Test public void attachToActivity_proxyIsSet_V2Embedding() { InAppPurchasePlugin plugin = new InAppPurchasePlugin(); plugin.onAttachedToEngine(flutterPluginBinding); plugin.onAttachedToActivity(activityPluginBinding); - // The `PROXY_PACKAGE_KEY` value is hard coded in the plugin code as "io.flutter.plugins.inapppurchase". - // We cannot use `BuildConfig.LIBRARY_PACKAGE_NAME` directly in the plugin code because whether to read BuildConfig.APPLICATION_ID or LIBRARY_PACKAGE_NAME - // depends on the "APP's" Android Gradle plugin version. Newer versions of AGP use LIBRARY_PACKAGE_NAME, whereas older ones use BuildConfig.APPLICATION_ID. + // The `PROXY_PACKAGE_KEY` value is hard coded in the plugin code as + // "io.flutter.plugins.inapppurchase". + // We cannot use `BuildConfig.LIBRARY_PACKAGE_NAME` directly in the plugin code because whether + // to read BuildConfig.APPLICATION_ID or LIBRARY_PACKAGE_NAME + // depends on the "APP's" Android Gradle plugin version. Newer versions of AGP use + // LIBRARY_PACKAGE_NAME, whereas older ones use BuildConfig.APPLICATION_ID. Mockito.verify(mockIntent).putExtra(PROXY_PACKAGE_KEY, "io.flutter.plugins.inapppurchase"); assertEquals("io.flutter.plugins.inapppurchase", BuildConfig.LIBRARY_PACKAGE_NAME); } } -// We cannot use `BuildConfig.LIBRARY_PACKAGE_NAME` directly in the plugin code because whether to read BuildConfig.APPLICATION_ID or LIBRARY_PACKAGE_NAME -// depends on the "APP's" Android Gradle plugin version. Newer versions of AGP use LIBRARY_PACKAGE_NAME, whereas older ones use BuildConfig.APPLICATION_ID. +// We cannot use `BuildConfig.LIBRARY_PACKAGE_NAME` directly in the plugin code because whether to +// read BuildConfig.APPLICATION_ID or LIBRARY_PACKAGE_NAME +// depends on the "APP's" Android Gradle plugin version. Newer versions of AGP use +// LIBRARY_PACKAGE_NAME, whereas older ones use BuildConfig.APPLICATION_ID. diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java index d4cfeda77d0d..e48f2d14b71b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java @@ -1194,7 +1194,9 @@ private List buildProductList( private ProductDetails buildProductDetails(String id) { String json = String.format( - "{\"title\":\"Example title\",\"description\":\"Example description\",\"productId\":\"%s\",\"type\":\"inapp\",\"name\":\"Example name\",\"oneTimePurchaseOfferDetails\":{\"priceAmountMicros\":990000,\"priceCurrencyCode\":\"USD\",\"formattedPrice\":\"$0.99\"}}", + "{\"title\":\"Example title\",\"description\":\"Example" + + " description\",\"productId\":\"%s\",\"type\":\"inapp\",\"name\":\"Example" + + " name\",\"oneTimePurchaseOfferDetails\":{\"priceAmountMicros\":990000,\"priceCurrencyCode\":\"USD\",\"formattedPrice\":\"$0.99\"}}", id); try { diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java index b8c7fb4e8ccb..6d6f60904dcd 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java @@ -30,11 +30,21 @@ public class TranslatorTest { private static final String PURCHASE_EXAMPLE_JSON = - "{\"orderId\":\"foo\",\"packageName\":\"bar\",\"productId\":\"consumable\",\"purchaseTime\":11111111,\"purchaseState\":0,\"purchaseToken\":\"baz\",\"developerPayload\":\"dummy payload\",\"isAcknowledged\":\"true\", \"obfuscatedAccountId\":\"Account101\", \"obfuscatedProfileId\":\"Profile105\"}"; + "{\"orderId\":\"foo\",\"packageName\":\"bar\",\"productId\":\"consumable\",\"purchaseTime\":11111111,\"purchaseState\":0,\"purchaseToken\":\"baz\",\"developerPayload\":\"dummy" + + " payload\",\"isAcknowledged\":\"true\", \"obfuscatedAccountId\":\"Account101\"," + + " \"obfuscatedProfileId\":\"Profile105\"}"; private static final String IN_APP_PRODUCT_DETAIL_EXAMPLE_JSON = - "{\"title\":\"Example title\",\"description\":\"Example description\",\"productId\":\"Example id\",\"type\":\"inapp\",\"name\":\"Example name\",\"oneTimePurchaseOfferDetails\":{\"priceAmountMicros\":990000,\"priceCurrencyCode\":\"USD\",\"formattedPrice\":\"$0.99\"}}"; + "{\"title\":\"Example title\",\"description\":\"Example description\",\"productId\":\"Example" + + " id\",\"type\":\"inapp\",\"name\":\"Example" + + " name\",\"oneTimePurchaseOfferDetails\":{\"priceAmountMicros\":990000,\"priceCurrencyCode\":\"USD\",\"formattedPrice\":\"$0.99\"}}"; private static final String SUBS_PRODUCT_DETAIL_EXAMPLE_JSON = - "{\"title\":\"Example title 2\",\"description\":\"Example description 2\",\"productId\":\"Example id 2\",\"type\":\"subs\",\"name\":\"Example name 2\",\"subscriptionOfferDetails\":[{\"offerId\":\"Example offer id\",\"basePlanId\":\"Example base plan id\",\"offerTags\":[\"Example offer tag\"],\"offerIdToken\":\"Example offer token\",\"pricingPhases\":[{\"formattedPrice\":\"$0.99\",\"priceCurrencyCode\":\"USD\",\"priceAmountMicros\":990000,\"billingCycleCount\":4,\"billingPeriod\":\"Example billing period\",\"recurrenceMode\":1}]}]}"; + "{\"title\":\"Example title 2\",\"description\":\"Example description" + + " 2\",\"productId\":\"Example id 2\",\"type\":\"subs\",\"name\":\"Example name" + + " 2\",\"subscriptionOfferDetails\":[{\"offerId\":\"Example offer" + + " id\",\"basePlanId\":\"Example base plan id\",\"offerTags\":[\"Example offer" + + " tag\"],\"offerIdToken\":\"Example offer" + + " token\",\"pricingPhases\":[{\"formattedPrice\":\"$0.99\",\"priceCurrencyCode\":\"USD\",\"priceAmountMicros\":990000,\"billingCycleCount\":4,\"billingPeriod\":\"Example" + + " billing period\",\"recurrenceMode\":1}]}]}"; Constructor productDetailsConstructor; @@ -115,7 +125,8 @@ public void fromPurchaseHistoryRecord() throws JSONException { @Test public void fromPurchasesHistoryRecordList() throws JSONException { final String purchase2Json = - "{\"orderId\":\"foo2\",\"packageName\":\"bar\",\"productId\":\"consumable\",\"purchaseTime\":11111111,\"purchaseState\":0,\"purchaseToken\":\"baz\",\"developerPayload\":\"dummy payload\",\"isAcknowledged\":\"true\"}"; + "{\"orderId\":\"foo2\",\"packageName\":\"bar\",\"productId\":\"consumable\",\"purchaseTime\":11111111,\"purchaseState\":0,\"purchaseToken\":\"baz\",\"developerPayload\":\"dummy" + + " payload\",\"isAcknowledged\":\"true\"}"; final String signature = "signature"; final List expected = Arrays.asList( @@ -138,7 +149,8 @@ public void fromPurchasesHistoryRecordList_null() { @Test public void fromPurchasesList() throws JSONException { final String purchase2Json = - "{\"orderId\":\"foo2\",\"packageName\":\"bar\",\"productId\":\"consumable\",\"purchaseTime\":11111111,\"purchaseState\":0,\"purchaseToken\":\"baz\",\"developerPayload\":\"dummy payload\",\"isAcknowledged\":\"true\"}"; + "{\"orderId\":\"foo2\",\"packageName\":\"bar\",\"productId\":\"consumable\",\"purchaseTime\":11111111,\"purchaseState\":0,\"purchaseToken\":\"baz\",\"developerPayload\":\"dummy" + + " payload\",\"isAcknowledged\":\"true\"}"; final String signature = "signature"; final List expected = Arrays.asList( diff --git a/packages/local_auth/local_auth_android/CHANGELOG.md b/packages/local_auth/local_auth_android/CHANGELOG.md index 5e329a9a2d26..3cba0eb61970 100644 --- a/packages/local_auth/local_auth_android/CHANGELOG.md +++ b/packages/local_auth/local_auth_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.8 + +* Updates internal implementation to use Kotlin Pigeon. + ## 2.0.7 * Updates build files from Groovy to Kotlin. diff --git a/packages/local_auth/local_auth_android/android/build.gradle.kts b/packages/local_auth/local_auth_android/android/build.gradle.kts index 11af0e4afa4e..e9321f91a6d9 100644 --- a/packages/local_auth/local_auth_android/android/build.gradle.kts +++ b/packages/local_auth/local_auth_android/android/build.gradle.kts @@ -1,7 +1,10 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + group = "io.flutter.plugins.localauth" version = "1.0-SNAPSHOT" buildscript { + val kotlinVersion = "2.3.20" repositories { google() mavenCentral() @@ -9,6 +12,7 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:8.13.1") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") } } @@ -21,6 +25,13 @@ rootProject.allprojects { plugins { id("com.android.library") + id("kotlin-android") +} + +kotlin { + compilerOptions { + jvmTarget = JvmTarget.fromTarget(JavaVersion.VERSION_17.toString()) + } } android { diff --git a/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java b/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java index 4da8d5f2c361..216791a9d6d1 100644 --- a/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java +++ b/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/AuthenticationHelper.java @@ -16,8 +16,6 @@ import androidx.lifecycle.DefaultLifecycleObserver; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleOwner; -import io.flutter.plugins.localauth.Messages.AuthResult; -import io.flutter.plugins.localauth.Messages.AuthResultCode; import java.util.concurrent.Executor; /** @@ -37,7 +35,6 @@ interface AuthCompletionHandler { private final Lifecycle lifecycle; private final FragmentActivity activity; private final AuthCompletionHandler completionHandler; - private final Messages.AuthStrings strings; private final BiometricPrompt.PromptInfo promptInfo; private final boolean isAuthSticky; private final UiThreadExecutor uiThreadExecutor; @@ -47,14 +44,13 @@ interface AuthCompletionHandler { AuthenticationHelper( Lifecycle lifecycle, FragmentActivity activity, - @NonNull Messages.AuthOptions options, - @NonNull Messages.AuthStrings strings, + @NonNull AuthOptions options, + @NonNull AuthStrings strings, @NonNull AuthCompletionHandler completionHandler, boolean allowCredentials) { this.lifecycle = lifecycle; this.activity = activity; this.completionHandler = completionHandler; - this.strings = strings; this.isAuthSticky = options.getSticky(); this.uiThreadExecutor = new UiThreadExecutor(); @@ -157,14 +153,13 @@ public void onAuthenticationError(int errorCode, @NonNull CharSequence errString code = AuthResultCode.UNKNOWN_ERROR; break; } - completionHandler.complete( - new AuthResult.Builder().setCode(code).setErrorMessage(errString.toString()).build()); + completionHandler.complete(new AuthResult(code, errString.toString())); stop(); } @Override public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) { - completionHandler.complete(new AuthResult.Builder().setCode(AuthResultCode.SUCCESS).build()); + completionHandler.complete(new AuthResult(AuthResultCode.SUCCESS, null)); stop(); } diff --git a/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java b/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java index 7b02af92382e..119fe2402824 100644 --- a/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java +++ b/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java @@ -11,6 +11,7 @@ import android.content.Context; import android.os.Build; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.biometric.BiometricManager; import androidx.fragment.app.FragmentActivity; @@ -20,16 +21,13 @@ import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter; import io.flutter.plugins.localauth.AuthenticationHelper.AuthCompletionHandler; -import io.flutter.plugins.localauth.Messages.AuthClassification; -import io.flutter.plugins.localauth.Messages.AuthOptions; -import io.flutter.plugins.localauth.Messages.AuthResult; -import io.flutter.plugins.localauth.Messages.AuthResultCode; -import io.flutter.plugins.localauth.Messages.AuthStrings; -import io.flutter.plugins.localauth.Messages.LocalAuthApi; -import io.flutter.plugins.localauth.Messages.Result; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import kotlin.Result; +import kotlin.Unit; +import kotlin.jvm.functions.Function1; +import org.jetbrains.annotations.NotNull; /** * Flutter plugin providing access to local authentication. @@ -54,17 +52,17 @@ public class LocalAuthPlugin implements FlutterPlugin, ActivityAware, LocalAuthA public LocalAuthPlugin() {} @Override - public @NonNull Boolean isDeviceSupported() { + public boolean isDeviceSupported() { return isDeviceSecure() || canAuthenticateWithBiometrics(); } @Override - public @NonNull Boolean deviceCanSupportBiometrics() { + public boolean deviceCanSupportBiometrics() { return hasBiometricHardware(); } @Override - public @NonNull List getEnrolledBiometrics() { + public @Nullable List getEnrolledBiometrics() { if (biometricManager == null) { return null; } @@ -81,7 +79,7 @@ public LocalAuthPlugin() {} } @Override - public @NonNull Boolean stopAuthentication() { + public boolean stopAuthentication() { try { if (authHelper != null && authInProgress.get()) { authHelper.stopAuthentication(); @@ -98,30 +96,32 @@ public LocalAuthPlugin() {} public void authenticate( @NonNull AuthOptions options, @NonNull AuthStrings strings, - @NonNull Result result) { + @NonNull Function1, @NotNull Unit> callback) { if (authInProgress.get()) { - result.success(new AuthResult.Builder().setCode(AuthResultCode.ALREADY_IN_PROGRESS).build()); + ResultUtilsKt.completeWithValue( + callback, new AuthResult(AuthResultCode.ALREADY_IN_PROGRESS, null)); return; } if (activity == null || activity.isFinishing()) { - result.success(new AuthResult.Builder().setCode(AuthResultCode.NO_ACTIVITY).build()); + ResultUtilsKt.completeWithValue(callback, new AuthResult(AuthResultCode.NO_ACTIVITY, null)); return; } if (!(activity instanceof FragmentActivity)) { - result.success( - new AuthResult.Builder().setCode(AuthResultCode.NOT_FRAGMENT_ACTIVITY).build()); + ResultUtilsKt.completeWithValue( + callback, new AuthResult(AuthResultCode.NOT_FRAGMENT_ACTIVITY, null)); return; } if (!isDeviceSupported()) { - result.success(new AuthResult.Builder().setCode(AuthResultCode.NO_CREDENTIALS).build()); + ResultUtilsKt.completeWithValue( + callback, new AuthResult(AuthResultCode.NO_CREDENTIALS, null)); return; } authInProgress.set(true); - AuthCompletionHandler completionHandler = createAuthCompletionHandler(result); + AuthCompletionHandler completionHandler = createAuthCompletionHandler(callback); boolean allowCredentials = !options.getBiometricOnly() && canAuthenticateWithDeviceCredential(); @@ -130,8 +130,8 @@ public void authenticate( @VisibleForTesting public @NonNull AuthCompletionHandler createAuthCompletionHandler( - @NonNull final Result result) { - return authResult -> onAuthenticationCompleted(result, authResult); + @NonNull Function1, @NotNull Unit> callback) { + return authResult -> onAuthenticationCompleted(callback, authResult); } @VisibleForTesting @@ -152,9 +152,11 @@ public void sendAuthenticationRequest( authHelper.authenticate(); } - void onAuthenticationCompleted(Result result, AuthResult value) { + void onAuthenticationCompleted( + @NonNull Function1, @NotNull Unit> callback, + AuthResult value) { if (authInProgress.compareAndSet(true, false)) { - result.success(value); + ResultUtilsKt.completeWithValue(callback, value); } } @@ -192,12 +194,12 @@ public boolean canAuthenticateWithDeviceCredential() { @Override public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { - LocalAuthApi.setUp(binding.getBinaryMessenger(), this); + LocalAuthApi.Companion.setUp(binding.getBinaryMessenger(), this); } @Override public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { - LocalAuthApi.setUp(binding.getBinaryMessenger(), null); + LocalAuthApi.Companion.setUp(binding.getBinaryMessenger(), null); } private void setServicesFromActivity(Activity activity) { diff --git a/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/Messages.java b/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/Messages.java deleted file mode 100644 index fe20c622d4ac..000000000000 --- a/packages/local_auth/local_auth_android/android/src/main/java/io/flutter/plugins/localauth/Messages.java +++ /dev/null @@ -1,745 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -package io.flutter.plugins.localauth; - -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.CLASS; - -import android.util.Log; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MessageCodec; -import io.flutter.plugin.common.StandardMessageCodec; -import java.io.ByteArrayOutputStream; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** Generated class from Pigeon. */ -@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) -public class Messages { - - /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ - public static class FlutterError extends RuntimeException { - - /** The error code. */ - public final String code; - - /** The error details. Must be a datatype supported by the api codec. */ - public final Object details; - - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { - super(message); - this.code = code; - this.details = details; - } - } - - @NonNull - protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList<>(3); - if (exception instanceof FlutterError) { - FlutterError error = (FlutterError) exception; - errorList.add(error.code); - errorList.add(error.getMessage()); - errorList.add(error.details); - } else { - errorList.add(exception.toString()); - errorList.add(exception.getClass().getSimpleName()); - errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); - } - return errorList; - } - - @Target(METHOD) - @Retention(CLASS) - @interface CanIgnoreReturnValue {} - - /** Possible outcomes of an authentication attempt. */ - public enum AuthResultCode { - /** The user authenticated successfully. */ - SUCCESS(0), - /** The user pressed the negative button, which corresponds to [AuthStrings.cancelButton]. */ - NEGATIVE_BUTTON(1), - /** - * The user canceled authentication without pressing the negative button. - * - *

This may be triggered by a swipe or a back button, for example. - */ - USER_CANCELED(2), - /** Authentication was caneceled by the system. */ - SYSTEM_CANCELED(3), - /** Authentication timed out. */ - TIMEOUT(4), - /** An authentication was already in progress. */ - ALREADY_IN_PROGRESS(5), - /** There is no foreground activity. */ - NO_ACTIVITY(6), - /** The foreground activity is not a FragmentActivity. */ - NOT_FRAGMENT_ACTIVITY(7), - /** The device does not have any credentials available. */ - NO_CREDENTIALS(8), - /** No biometric hardware is present. */ - NO_HARDWARE(9), - /** The biometric is temporarily unavailable. */ - HARDWARE_UNAVAILABLE(10), - /** No biometrics are enrolled. */ - NOT_ENROLLED(11), - /** The user is locked out temporarily due to too many failed attempts. */ - LOCKED_OUT_TEMPORARILY(12), - /** The user is locked out until they log in another way due to too many failed attempts. */ - LOCKED_OUT_PERMANENTLY(13), - /** The device does not have enough storage to complete authentication. */ - NO_SPACE(14), - /** The hardware is unavailable until a security update is performed. */ - SECURITY_UPDATE_REQUIRED(15), - /** Some unrecognized error case was encountered */ - UNKNOWN_ERROR(16); - - final int index; - - AuthResultCode(final int index) { - this.index = index; - } - } - - /** Pigeon equivalent of the subset of BiometricType used by Android. */ - public enum AuthClassification { - WEAK(0), - STRONG(1); - - final int index; - - AuthClassification(final int index) { - this.index = index; - } - } - - /** - * Pigeon version of AndroidAuthStrings, plus the authorization reason. - * - *

See auth_messages_android.dart for details. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class AuthStrings { - private @NonNull String reason; - - public @NonNull String getReason() { - return reason; - } - - public void setReason(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"reason\" is null."); - } - this.reason = setterArg; - } - - private @NonNull String signInHint; - - public @NonNull String getSignInHint() { - return signInHint; - } - - public void setSignInHint(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"signInHint\" is null."); - } - this.signInHint = setterArg; - } - - private @NonNull String cancelButton; - - public @NonNull String getCancelButton() { - return cancelButton; - } - - public void setCancelButton(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"cancelButton\" is null."); - } - this.cancelButton = setterArg; - } - - private @NonNull String signInTitle; - - public @NonNull String getSignInTitle() { - return signInTitle; - } - - public void setSignInTitle(@NonNull String setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"signInTitle\" is null."); - } - this.signInTitle = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - AuthStrings() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuthStrings that = (AuthStrings) o; - return reason.equals(that.reason) - && signInHint.equals(that.signInHint) - && cancelButton.equals(that.cancelButton) - && signInTitle.equals(that.signInTitle); - } - - @Override - public int hashCode() { - return Objects.hash(reason, signInHint, cancelButton, signInTitle); - } - - public static final class Builder { - - private @Nullable String reason; - - @CanIgnoreReturnValue - public @NonNull Builder setReason(@NonNull String setterArg) { - this.reason = setterArg; - return this; - } - - private @Nullable String signInHint; - - @CanIgnoreReturnValue - public @NonNull Builder setSignInHint(@NonNull String setterArg) { - this.signInHint = setterArg; - return this; - } - - private @Nullable String cancelButton; - - @CanIgnoreReturnValue - public @NonNull Builder setCancelButton(@NonNull String setterArg) { - this.cancelButton = setterArg; - return this; - } - - private @Nullable String signInTitle; - - @CanIgnoreReturnValue - public @NonNull Builder setSignInTitle(@NonNull String setterArg) { - this.signInTitle = setterArg; - return this; - } - - public @NonNull AuthStrings build() { - AuthStrings pigeonReturn = new AuthStrings(); - pigeonReturn.setReason(reason); - pigeonReturn.setSignInHint(signInHint); - pigeonReturn.setCancelButton(cancelButton); - pigeonReturn.setSignInTitle(signInTitle); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(4); - toListResult.add(reason); - toListResult.add(signInHint); - toListResult.add(cancelButton); - toListResult.add(signInTitle); - return toListResult; - } - - static @NonNull AuthStrings fromList(@NonNull ArrayList pigeonVar_list) { - AuthStrings pigeonResult = new AuthStrings(); - Object reason = pigeonVar_list.get(0); - pigeonResult.setReason((String) reason); - Object signInHint = pigeonVar_list.get(1); - pigeonResult.setSignInHint((String) signInHint); - Object cancelButton = pigeonVar_list.get(2); - pigeonResult.setCancelButton((String) cancelButton); - Object signInTitle = pigeonVar_list.get(3); - pigeonResult.setSignInTitle((String) signInTitle); - return pigeonResult; - } - } - - /** - * The results of an authentication request. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class AuthResult { - /** The specific result returned from the SDK. */ - private @NonNull AuthResultCode code; - - public @NonNull AuthResultCode getCode() { - return code; - } - - public void setCode(@NonNull AuthResultCode setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"code\" is null."); - } - this.code = setterArg; - } - - /** The error message associated with the result, if any. */ - private @Nullable String errorMessage; - - public @Nullable String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(@Nullable String setterArg) { - this.errorMessage = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - AuthResult() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuthResult that = (AuthResult) o; - return code.equals(that.code) && Objects.equals(errorMessage, that.errorMessage); - } - - @Override - public int hashCode() { - return Objects.hash(code, errorMessage); - } - - public static final class Builder { - - private @Nullable AuthResultCode code; - - @CanIgnoreReturnValue - public @NonNull Builder setCode(@NonNull AuthResultCode setterArg) { - this.code = setterArg; - return this; - } - - private @Nullable String errorMessage; - - @CanIgnoreReturnValue - public @NonNull Builder setErrorMessage(@Nullable String setterArg) { - this.errorMessage = setterArg; - return this; - } - - public @NonNull AuthResult build() { - AuthResult pigeonReturn = new AuthResult(); - pigeonReturn.setCode(code); - pigeonReturn.setErrorMessage(errorMessage); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); - toListResult.add(code); - toListResult.add(errorMessage); - return toListResult; - } - - static @NonNull AuthResult fromList(@NonNull ArrayList pigeonVar_list) { - AuthResult pigeonResult = new AuthResult(); - Object code = pigeonVar_list.get(0); - pigeonResult.setCode((AuthResultCode) code); - Object errorMessage = pigeonVar_list.get(1); - pigeonResult.setErrorMessage((String) errorMessage); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class AuthOptions { - private @NonNull Boolean biometricOnly; - - public @NonNull Boolean getBiometricOnly() { - return biometricOnly; - } - - public void setBiometricOnly(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"biometricOnly\" is null."); - } - this.biometricOnly = setterArg; - } - - private @NonNull Boolean sensitiveTransaction; - - public @NonNull Boolean getSensitiveTransaction() { - return sensitiveTransaction; - } - - public void setSensitiveTransaction(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"sensitiveTransaction\" is null."); - } - this.sensitiveTransaction = setterArg; - } - - private @NonNull Boolean sticky; - - public @NonNull Boolean getSticky() { - return sticky; - } - - public void setSticky(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"sticky\" is null."); - } - this.sticky = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - AuthOptions() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuthOptions that = (AuthOptions) o; - return biometricOnly.equals(that.biometricOnly) - && sensitiveTransaction.equals(that.sensitiveTransaction) - && sticky.equals(that.sticky); - } - - @Override - public int hashCode() { - return Objects.hash(biometricOnly, sensitiveTransaction, sticky); - } - - public static final class Builder { - - private @Nullable Boolean biometricOnly; - - @CanIgnoreReturnValue - public @NonNull Builder setBiometricOnly(@NonNull Boolean setterArg) { - this.biometricOnly = setterArg; - return this; - } - - private @Nullable Boolean sensitiveTransaction; - - @CanIgnoreReturnValue - public @NonNull Builder setSensitiveTransaction(@NonNull Boolean setterArg) { - this.sensitiveTransaction = setterArg; - return this; - } - - private @Nullable Boolean sticky; - - @CanIgnoreReturnValue - public @NonNull Builder setSticky(@NonNull Boolean setterArg) { - this.sticky = setterArg; - return this; - } - - public @NonNull AuthOptions build() { - AuthOptions pigeonReturn = new AuthOptions(); - pigeonReturn.setBiometricOnly(biometricOnly); - pigeonReturn.setSensitiveTransaction(sensitiveTransaction); - pigeonReturn.setSticky(sticky); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(biometricOnly); - toListResult.add(sensitiveTransaction); - toListResult.add(sticky); - return toListResult; - } - - static @NonNull AuthOptions fromList(@NonNull ArrayList pigeonVar_list) { - AuthOptions pigeonResult = new AuthOptions(); - Object biometricOnly = pigeonVar_list.get(0); - pigeonResult.setBiometricOnly((Boolean) biometricOnly); - Object sensitiveTransaction = pigeonVar_list.get(1); - pigeonResult.setSensitiveTransaction((Boolean) sensitiveTransaction); - Object sticky = pigeonVar_list.get(2); - pigeonResult.setSticky((Boolean) sticky); - return pigeonResult; - } - } - - private static class PigeonCodec extends StandardMessageCodec { - public static final PigeonCodec INSTANCE = new PigeonCodec(); - - private PigeonCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : AuthResultCode.values()[((Long) value).intValue()]; - } - case (byte) 130: - { - Object value = readValue(buffer); - return value == null ? null : AuthClassification.values()[((Long) value).intValue()]; - } - case (byte) 131: - return AuthStrings.fromList((ArrayList) readValue(buffer)); - case (byte) 132: - return AuthResult.fromList((ArrayList) readValue(buffer)); - case (byte) 133: - return AuthOptions.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof AuthResultCode) { - stream.write(129); - writeValue(stream, value == null ? null : ((AuthResultCode) value).index); - } else if (value instanceof AuthClassification) { - stream.write(130); - writeValue(stream, value == null ? null : ((AuthClassification) value).index); - } else if (value instanceof AuthStrings) { - stream.write(131); - writeValue(stream, ((AuthStrings) value).toList()); - } else if (value instanceof AuthResult) { - stream.write(132); - writeValue(stream, ((AuthResult) value).toList()); - } else if (value instanceof AuthOptions) { - stream.write(133); - writeValue(stream, ((AuthOptions) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - - /** Asynchronous error handling return type for non-nullable API method returns. */ - public interface Result { - /** Success case callback method for handling returns. */ - void success(@NonNull T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for nullable API method returns. */ - public interface NullableResult { - /** Success case callback method for handling returns. */ - void success(@Nullable T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for void API method returns. */ - public interface VoidResult { - /** Success case callback method for handling returns. */ - void success(); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface LocalAuthApi { - /** Returns true if this device supports authentication. */ - @NonNull - Boolean isDeviceSupported(); - /** - * Returns true if this device can support biometric authentication, whether any biometrics are - * enrolled or not. - */ - @NonNull - Boolean deviceCanSupportBiometrics(); - /** - * Cancels any in-progress authentication. - * - *

Returns true only if authentication was in progress, and was successfully cancelled. - */ - @NonNull - Boolean stopAuthentication(); - /** - * Returns the biometric types that are enrolled, and can thus be used without additional setup. - * - *

Returns null if there is no activity, in which case the enrolled biometrics can't be - * determined. - */ - @Nullable - List getEnrolledBiometrics(); - /** - * Attempts to authenticate the user with the provided [options], and using [strings] for any - * UI. - */ - void authenticate( - @NonNull AuthOptions options, - @NonNull AuthStrings strings, - @NonNull Result result); - - /** The codec used by LocalAuthApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** Sets up an instance of `LocalAuthApi` to handle messages through the `binaryMessenger`. */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable LocalAuthApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable LocalAuthApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.local_auth_android.LocalAuthApi.isDeviceSupported" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.isDeviceSupported(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.local_auth_android.LocalAuthApi.deviceCanSupportBiometrics" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.deviceCanSupportBiometrics(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.local_auth_android.LocalAuthApi.stopAuthentication" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.stopAuthentication(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.local_auth_android.LocalAuthApi.getEnrolledBiometrics" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - List output = api.getEnrolledBiometrics(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.local_auth_android.LocalAuthApi.authenticate" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - AuthOptions optionsArg = (AuthOptions) args.get(0); - AuthStrings stringsArg = (AuthStrings) args.get(1); - Result resultCallback = - new Result() { - public void success(AuthResult result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.authenticate(optionsArg, stringsArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } -} diff --git a/packages/local_auth/local_auth_android/android/src/main/kotlin/io/flutter/plugins/localauth/Messages.kt b/packages/local_auth/local_auth_android/android/src/main/kotlin/io/flutter/plugins/localauth/Messages.kt new file mode 100644 index 000000000000..5822b5b85b64 --- /dev/null +++ b/packages/local_auth/local_auth_android/android/src/main/kotlin/io/flutter/plugins/localauth/Messages.kt @@ -0,0 +1,454 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// Autogenerated from Pigeon (v26.2.3), do not edit directly. +// See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") + +package io.flutter.plugins.localauth + +import android.util.Log +import io.flutter.plugin.common.BasicMessageChannel +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.MessageCodec +import io.flutter.plugin.common.StandardMessageCodec +import java.io.ByteArrayOutputStream +import java.nio.ByteBuffer + +private object MessagesPigeonUtils { + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } + } + + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + return a.contentEquals(b) + } + if (a is Array<*> && b is Array<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is List<*> && b is List<*>) { + return a.size == b.size && a.indices.all { deepEquals(a[it], b[it]) } + } + if (a is Map<*, *> && b is Map<*, *>) { + return a.size == b.size && + a.all { (b as Map).contains(it.key) && deepEquals(it.value, b[it.key]) } + } + return a == b + } +} + +/** + * Error class for passing custom error details to Flutter via a thrown PlatformException. + * + * @property code The error code. + * @property message The error message. + * @property details The error details. Must be a datatype supported by the api codec. + */ +class FlutterError( + val code: String, + override val message: String? = null, + val details: Any? = null +) : Throwable() + +/** Possible outcomes of an authentication attempt. */ +enum class AuthResultCode(val raw: Int) { + /** The user authenticated successfully. */ + SUCCESS(0), + /** The user pressed the negative button, which corresponds to [AuthStrings.cancelButton]. */ + NEGATIVE_BUTTON(1), + /** + * The user canceled authentication without pressing the negative button. + * + * This may be triggered by a swipe or a back button, for example. + */ + USER_CANCELED(2), + /** Authentication was caneceled by the system. */ + SYSTEM_CANCELED(3), + /** Authentication timed out. */ + TIMEOUT(4), + /** An authentication was already in progress. */ + ALREADY_IN_PROGRESS(5), + /** There is no foreground activity. */ + NO_ACTIVITY(6), + /** The foreground activity is not a FragmentActivity. */ + NOT_FRAGMENT_ACTIVITY(7), + /** The device does not have any credentials available. */ + NO_CREDENTIALS(8), + /** No biometric hardware is present. */ + NO_HARDWARE(9), + /** The biometric is temporarily unavailable. */ + HARDWARE_UNAVAILABLE(10), + /** No biometrics are enrolled. */ + NOT_ENROLLED(11), + /** The user is locked out temporarily due to too many failed attempts. */ + LOCKED_OUT_TEMPORARILY(12), + /** The user is locked out until they log in another way due to too many failed attempts. */ + LOCKED_OUT_PERMANENTLY(13), + /** The device does not have enough storage to complete authentication. */ + NO_SPACE(14), + /** The hardware is unavailable until a security update is performed. */ + SECURITY_UPDATE_REQUIRED(15), + /** Some unrecognized error case was encountered */ + UNKNOWN_ERROR(16); + + companion object { + fun ofRaw(raw: Int): AuthResultCode? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** Pigeon equivalent of the subset of BiometricType used by Android. */ +enum class AuthClassification(val raw: Int) { + WEAK(0), + STRONG(1); + + companion object { + fun ofRaw(raw: Int): AuthClassification? { + return values().firstOrNull { it.raw == raw } + } + } +} + +/** + * Pigeon version of AndroidAuthStrings, plus the authorization reason. + * + * See auth_messages_android.dart for details. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class AuthStrings( + val reason: String, + val signInHint: String, + val cancelButton: String, + val signInTitle: String +) { + companion object { + fun fromList(pigeonVar_list: List): AuthStrings { + val reason = pigeonVar_list[0] as String + val signInHint = pigeonVar_list[1] as String + val cancelButton = pigeonVar_list[2] as String + val signInTitle = pigeonVar_list[3] as String + return AuthStrings(reason, signInHint, cancelButton, signInTitle) + } + } + + fun toList(): List { + return listOf( + reason, + signInHint, + cancelButton, + signInTitle, + ) + } + + override fun equals(other: Any?): Boolean { + if (other !is AuthStrings) { + return false + } + if (this === other) { + return true + } + return MessagesPigeonUtils.deepEquals(toList(), other.toList()) + } + + override fun hashCode(): Int = toList().hashCode() +} + +/** + * The results of an authentication request. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class AuthResult( + /** The specific result returned from the SDK. */ + val code: AuthResultCode, + /** The error message associated with the result, if any. */ + val errorMessage: String? = null +) { + companion object { + fun fromList(pigeonVar_list: List): AuthResult { + val code = pigeonVar_list[0] as AuthResultCode + val errorMessage = pigeonVar_list[1] as String? + return AuthResult(code, errorMessage) + } + } + + fun toList(): List { + return listOf( + code, + errorMessage, + ) + } + + override fun equals(other: Any?): Boolean { + if (other !is AuthResult) { + return false + } + if (this === other) { + return true + } + return MessagesPigeonUtils.deepEquals(toList(), other.toList()) + } + + override fun hashCode(): Int = toList().hashCode() +} + +/** Generated class from Pigeon that represents data sent in messages. */ +data class AuthOptions( + val biometricOnly: Boolean, + val sensitiveTransaction: Boolean, + val sticky: Boolean +) { + companion object { + fun fromList(pigeonVar_list: List): AuthOptions { + val biometricOnly = pigeonVar_list[0] as Boolean + val sensitiveTransaction = pigeonVar_list[1] as Boolean + val sticky = pigeonVar_list[2] as Boolean + return AuthOptions(biometricOnly, sensitiveTransaction, sticky) + } + } + + fun toList(): List { + return listOf( + biometricOnly, + sensitiveTransaction, + sticky, + ) + } + + override fun equals(other: Any?): Boolean { + if (other !is AuthOptions) { + return false + } + if (this === other) { + return true + } + return MessagesPigeonUtils.deepEquals(toList(), other.toList()) + } + + override fun hashCode(): Int = toList().hashCode() +} + +private open class MessagesPigeonCodec : StandardMessageCodec() { + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return when (type) { + 129.toByte() -> { + return (readValue(buffer) as Long?)?.let { AuthResultCode.ofRaw(it.toInt()) } + } + 130.toByte() -> { + return (readValue(buffer) as Long?)?.let { AuthClassification.ofRaw(it.toInt()) } + } + 131.toByte() -> { + return (readValue(buffer) as? List)?.let { AuthStrings.fromList(it) } + } + 132.toByte() -> { + return (readValue(buffer) as? List)?.let { AuthResult.fromList(it) } + } + 133.toByte() -> { + return (readValue(buffer) as? List)?.let { AuthOptions.fromList(it) } + } + else -> super.readValueOfType(type, buffer) + } + } + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + when (value) { + is AuthResultCode -> { + stream.write(129) + writeValue(stream, value.raw.toLong()) + } + is AuthClassification -> { + stream.write(130) + writeValue(stream, value.raw.toLong()) + } + is AuthStrings -> { + stream.write(131) + writeValue(stream, value.toList()) + } + is AuthResult -> { + stream.write(132) + writeValue(stream, value.toList()) + } + is AuthOptions -> { + stream.write(133) + writeValue(stream, value.toList()) + } + else -> super.writeValue(stream, value) + } + } +} + +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface LocalAuthApi { + /** Returns true if this device supports authentication. */ + fun isDeviceSupported(): Boolean + /** + * Returns true if this device can support biometric authentication, whether any biometrics are + * enrolled or not. + */ + fun deviceCanSupportBiometrics(): Boolean + /** + * Cancels any in-progress authentication. + * + * Returns true only if authentication was in progress, and was successfully cancelled. + */ + fun stopAuthentication(): Boolean + /** + * Returns the biometric types that are enrolled, and can thus be used without additional setup. + * + * Returns null if there is no activity, in which case the enrolled biometrics can't be + * determined. + */ + fun getEnrolledBiometrics(): List? + /** + * Attempts to authenticate the user with the provided [options], and using [strings] for any UI. + */ + fun authenticate( + options: AuthOptions, + strings: AuthStrings, + callback: (Result) -> Unit + ) + + companion object { + /** The codec used by LocalAuthApi. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + /** Sets up an instance of `LocalAuthApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp( + binaryMessenger: BinaryMessenger, + api: LocalAuthApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.local_auth_android.LocalAuthApi.isDeviceSupported$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.isDeviceSupported()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.local_auth_android.LocalAuthApi.deviceCanSupportBiometrics$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.deviceCanSupportBiometrics()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.local_auth_android.LocalAuthApi.stopAuthentication$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.stopAuthentication()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.local_auth_android.LocalAuthApi.getEnrolledBiometrics$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.getEnrolledBiometrics()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.local_auth_android.LocalAuthApi.authenticate$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val optionsArg = args[0] as AuthOptions + val stringsArg = args[1] as AuthStrings + api.authenticate(optionsArg, stringsArg) { result: Result -> + val error = result.exceptionOrNull() + if (error != null) { + reply.reply(MessagesPigeonUtils.wrapError(error)) + } else { + val data = result.getOrNull() + reply.reply(MessagesPigeonUtils.wrapResult(data)) + } + } + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} diff --git a/packages/local_auth/local_auth_android/android/src/main/kotlin/io/flutter/plugins/localauth/ResultUtils.kt b/packages/local_auth/local_auth_android/android/src/main/kotlin/io/flutter/plugins/localauth/ResultUtils.kt new file mode 100644 index 000000000000..7e811c893bac --- /dev/null +++ b/packages/local_auth/local_auth_android/android/src/main/kotlin/io/flutter/plugins/localauth/ResultUtils.kt @@ -0,0 +1,13 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.localauth + +fun completeWithError(callback: (Result<@JvmSuppressWildcards T>) -> Unit, failure: Throwable) { + callback(Result.failure(failure)) +} + +fun completeWithValue(callback: (Result<@JvmSuppressWildcards T>) -> Unit, value: T) { + callback(Result.success(value)) +} diff --git a/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/AuthenticationHelperTest.java b/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/AuthenticationHelperTest.java index d6020fa396fb..4c2db213148c 100644 --- a/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/AuthenticationHelperTest.java +++ b/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/AuthenticationHelperTest.java @@ -13,10 +13,6 @@ import androidx.biometric.BiometricPrompt; import androidx.fragment.app.FragmentActivity; import io.flutter.plugins.localauth.AuthenticationHelper.AuthCompletionHandler; -import io.flutter.plugins.localauth.Messages.AuthOptions; -import io.flutter.plugins.localauth.Messages.AuthResult; -import io.flutter.plugins.localauth.Messages.AuthResultCode; -import io.flutter.plugins.localauth.Messages.AuthStrings; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -27,19 +23,11 @@ @RunWith(RobolectricTestRunner.class) public class AuthenticationHelperTest { static final AuthStrings dummyStrings = - new AuthStrings.Builder() - .setReason("a reason") - .setSignInHint("a hint") - .setCancelButton("cancel") - .setSignInTitle("sign in") - .build(); + new AuthStrings("a reason", "a hint", "cancel", "sign in"); static final AuthOptions defaultOptions = - new AuthOptions.Builder() - .setBiometricOnly(false) - .setSensitiveTransaction(false) - .setSticky(false) - .build(); + new AuthOptions( + /* biometricOnly */ false, /* sensitiveTransaction */ false, /* sticky */ false); @Test public void onAuthenticationError_returnsUserCanceled() { @@ -55,12 +43,7 @@ public void onAuthenticationError_returnsUserCanceled() { helper.onAuthenticationError(BiometricPrompt.ERROR_USER_CANCELED, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.USER_CANCELED) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.USER_CANCELED, "")); } @Test @@ -77,12 +60,7 @@ public void onAuthenticationError_returnsNegativeButton() { helper.onAuthenticationError(BiometricPrompt.ERROR_NEGATIVE_BUTTON, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.NEGATIVE_BUTTON) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.NEGATIVE_BUTTON, "")); } @Test @@ -99,12 +77,7 @@ public void onAuthenticationError_withoutDialogs_returnsNoCredential() { helper.onAuthenticationError(BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.NO_CREDENTIALS) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.NO_CREDENTIALS, "")); } @Test @@ -121,12 +94,7 @@ public void onAuthenticationError_withoutDialogs_returnsNotEnrolledForNoBiometri helper.onAuthenticationError(BiometricPrompt.ERROR_NO_BIOMETRICS, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.NOT_ENROLLED) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.NOT_ENROLLED, "")); } @Test @@ -143,12 +111,7 @@ public void onAuthenticationError_returnsHardwareUnavailable() { helper.onAuthenticationError(BiometricPrompt.ERROR_HW_UNAVAILABLE, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.HARDWARE_UNAVAILABLE) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.HARDWARE_UNAVAILABLE, "")); } @Test @@ -165,12 +128,7 @@ public void onAuthenticationError_returnsHardwareNotPresent() { helper.onAuthenticationError(BiometricPrompt.ERROR_HW_NOT_PRESENT, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.NO_HARDWARE) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.NO_HARDWARE, "")); } @Test @@ -187,12 +145,7 @@ public void onAuthenticationError_returnsTemporaryLockoutForLockout() { helper.onAuthenticationError(BiometricPrompt.ERROR_LOCKOUT, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.LOCKED_OUT_TEMPORARILY) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.LOCKED_OUT_TEMPORARILY, "")); } @Test @@ -209,12 +162,7 @@ public void onAuthenticationError_returnsPermanentLockoutForLockoutPermanent() { helper.onAuthenticationError(BiometricPrompt.ERROR_LOCKOUT_PERMANENT, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.LOCKED_OUT_PERMANENTLY) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.LOCKED_OUT_PERMANENTLY, "")); } @Test @@ -231,12 +179,7 @@ public void onAuthenticationError_withoutSticky_returnsSystemCanceled() { helper.onAuthenticationError(BiometricPrompt.ERROR_CANCELED, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.SYSTEM_CANCELED) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.SYSTEM_CANCELED, "")); } @Test @@ -253,9 +196,7 @@ public void onAuthenticationError_returnsTimeout() { helper.onAuthenticationError(BiometricPrompt.ERROR_TIMEOUT, ""); - verify(handler) - .complete( - new AuthResult.Builder().setCode(AuthResultCode.TIMEOUT).setErrorMessage("").build()); + verify(handler).complete(new AuthResult(AuthResultCode.TIMEOUT, "")); } @Test @@ -272,9 +213,7 @@ public void onAuthenticationError_returnsNoSpace() { helper.onAuthenticationError(BiometricPrompt.ERROR_NO_SPACE, ""); - verify(handler) - .complete( - new AuthResult.Builder().setCode(AuthResultCode.NO_SPACE).setErrorMessage("").build()); + verify(handler).complete(new AuthResult(AuthResultCode.NO_SPACE, "")); } @Test @@ -291,12 +230,7 @@ public void onAuthenticationError_returnsSecurityUpdateRequired() { helper.onAuthenticationError(BiometricPrompt.ERROR_SECURITY_UPDATE_REQUIRED, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.SECURITY_UPDATE_REQUIRED) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.SECURITY_UPDATE_REQUIRED, "")); } @Test @@ -313,12 +247,7 @@ public void onAuthenticationError_returnsUnknownForOtherCases() { helper.onAuthenticationError(BiometricPrompt.ERROR_UNABLE_TO_PROCESS, ""); - verify(handler) - .complete( - new AuthResult.Builder() - .setCode(AuthResultCode.UNKNOWN_ERROR) - .setErrorMessage("") - .build()); + verify(handler).complete(new AuthResult(AuthResultCode.UNKNOWN_ERROR, "")); } private FragmentActivity buildMockActivityWithContext(FragmentActivity mockActivity) { diff --git a/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/LocalAuthTest.java b/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/LocalAuthTest.java index 5a58297360f5..5d580e1d3ed0 100644 --- a/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/LocalAuthTest.java +++ b/packages/local_auth/local_auth_android/android/src/test/java/io/flutter/plugins/localauth/LocalAuthTest.java @@ -14,7 +14,6 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.Activity; @@ -29,12 +28,6 @@ import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.localauth.AuthenticationHelper.AuthCompletionHandler; -import io.flutter.plugins.localauth.Messages.AuthClassification; -import io.flutter.plugins.localauth.Messages.AuthOptions; -import io.flutter.plugins.localauth.Messages.AuthResult; -import io.flutter.plugins.localauth.Messages.AuthResultCode; -import io.flutter.plugins.localauth.Messages.AuthStrings; -import io.flutter.plugins.localauth.Messages.Result; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; @@ -45,67 +38,79 @@ @RunWith(RobolectricTestRunner.class) public class LocalAuthTest { static final AuthStrings dummyStrings = - new AuthStrings.Builder() - .setReason("a reason") - .setSignInHint("a hint") - .setCancelButton("cancel") - .setSignInTitle("sign in") - .build(); + new AuthStrings("a reason", "a hint", "cancel", "sign in"); static final AuthOptions defaultOptions = - new AuthOptions.Builder() - .setBiometricOnly(false) - .setSensitiveTransaction(false) - .setSticky(false) - .build(); + new AuthOptions( + /* biometricOnly */ false, /* sensitiveTransaction */ false, /* sticky */ false); @Test public void authenticate_returnsErrorWhenAuthInProgress() { final LocalAuthPlugin plugin = new LocalAuthPlugin(); plugin.authInProgress.set(true); - @SuppressWarnings("unchecked") - final Result mockResult = mock(Result.class); - plugin.authenticate(defaultOptions, dummyStrings, mockResult); - ArgumentCaptor captor = ArgumentCaptor.forClass(AuthResult.class); - verify(mockResult).success(captor.capture()); - assertEquals(AuthResultCode.ALREADY_IN_PROGRESS, captor.getValue().getCode()); + final Boolean[] callbackCalled = new Boolean[1]; + plugin.authenticate( + defaultOptions, + dummyStrings, + ResultCompat.asCompatCallback( + reply -> { + callbackCalled[0] = true; + assertEquals(AuthResultCode.ALREADY_IN_PROGRESS, reply.getOrNull().getCode()); + return null; + })); + assertTrue(callbackCalled[0]); } @Test public void authenticate_returnsErrorWithNoForegroundActivity() { final LocalAuthPlugin plugin = new LocalAuthPlugin(); - @SuppressWarnings("unchecked") - final Result mockResult = mock(Result.class); - - plugin.authenticate(defaultOptions, dummyStrings, mockResult); - ArgumentCaptor captor = ArgumentCaptor.forClass(AuthResult.class); - verify(mockResult).success(captor.capture()); - assertEquals(AuthResultCode.NO_ACTIVITY, captor.getValue().getCode()); + final Boolean[] callbackCalled = new Boolean[1]; + + plugin.authenticate( + defaultOptions, + dummyStrings, + ResultCompat.asCompatCallback( + reply -> { + callbackCalled[0] = true; + assertEquals(AuthResultCode.NO_ACTIVITY, reply.getOrNull().getCode()); + return null; + })); + assertTrue(callbackCalled[0]); } @Test public void authenticate_returnsErrorWhenActivityNotFragmentActivity() { final LocalAuthPlugin plugin = new LocalAuthPlugin(); setPluginActivity(plugin, buildMockActivityWithContext(mock(NativeActivity.class))); - @SuppressWarnings("unchecked") - final Result mockResult = mock(Result.class); - plugin.authenticate(defaultOptions, dummyStrings, mockResult); - ArgumentCaptor captor = ArgumentCaptor.forClass(AuthResult.class); - verify(mockResult).success(captor.capture()); - assertEquals(AuthResultCode.NOT_FRAGMENT_ACTIVITY, captor.getValue().getCode()); + final Boolean[] callbackCalled = new Boolean[1]; + plugin.authenticate( + defaultOptions, + dummyStrings, + ResultCompat.asCompatCallback( + reply -> { + callbackCalled[0] = true; + assertEquals(AuthResultCode.NOT_FRAGMENT_ACTIVITY, reply.getOrNull().getCode()); + return null; + })); + assertTrue(callbackCalled[0]); } @Test public void authenticate_returnsErrorWhenDeviceNotSupported() { final LocalAuthPlugin plugin = new LocalAuthPlugin(); setPluginActivity(plugin, buildMockActivityWithContext(mock(FragmentActivity.class))); - @SuppressWarnings("unchecked") - final Result mockResult = mock(Result.class); - - plugin.authenticate(defaultOptions, dummyStrings, mockResult); - ArgumentCaptor captor = ArgumentCaptor.forClass(AuthResult.class); - verify(mockResult).success(captor.capture()); - assertEquals(AuthResultCode.NO_CREDENTIALS, captor.getValue().getCode()); + final Boolean[] callbackCalled = new Boolean[1]; + + plugin.authenticate( + defaultOptions, + dummyStrings, + ResultCompat.asCompatCallback( + reply -> { + callbackCalled[0] = true; + assertEquals(AuthResultCode.NO_CREDENTIALS, reply.getOrNull().getCode()); + return null; + })); + assertTrue(callbackCalled[0]); } @Test @@ -129,16 +134,17 @@ public void authenticate_properlyConfiguresBiometricOnlyAuthenticationRequest() any(AuthStrings.class), allowCredentialsCaptor.capture(), any(AuthCompletionHandler.class)); - @SuppressWarnings("unchecked") - final Result mockResult = mock(Result.class); - final AuthOptions options = - new AuthOptions.Builder() - .setBiometricOnly(true) - .setSensitiveTransaction(false) - .setSticky(false) - .build(); - plugin.authenticate(options, dummyStrings, mockResult); + new AuthOptions( + /* biometricOnly */ true, /* sensitiveTransaction */ false, /* sticky */ false); + ; + plugin.authenticate( + options, + dummyStrings, + ResultCompat.asCompatCallback( + reply -> { + return null; + })); assertFalse(allowCredentialsCaptor.getValue()); } @@ -162,10 +168,13 @@ public void authenticate_properlyConfiguresBiometricAndDeviceCredentialAuthentic any(AuthStrings.class), allowCredentialsCaptor.capture(), any(AuthCompletionHandler.class)); - @SuppressWarnings("unchecked") - final Result mockResult = mock(Result.class); - - plugin.authenticate(defaultOptions, dummyStrings, mockResult); + plugin.authenticate( + defaultOptions, + dummyStrings, + ResultCompat.asCompatCallback( + reply -> { + return null; + })); assertTrue(allowCredentialsCaptor.getValue()); } @@ -191,10 +200,13 @@ public void authenticate_properlyConfiguresDeviceCredentialOnlyAuthenticationReq any(AuthStrings.class), allowCredentialsCaptor.capture(), any(AuthCompletionHandler.class)); - @SuppressWarnings("unchecked") - final Result mockResult = mock(Result.class); - - plugin.authenticate(defaultOptions, dummyStrings, mockResult); + plugin.authenticate( + defaultOptions, + dummyStrings, + ResultCompat.asCompatCallback( + reply -> { + return null; + })); assertTrue(allowCredentialsCaptor.getValue()); } diff --git a/packages/local_auth/local_auth_android/android/src/test/kotlin/io/flutter/plugins/localauth/TestResultUtils.kt b/packages/local_auth/local_auth_android/android/src/test/kotlin/io/flutter/plugins/localauth/TestResultUtils.kt new file mode 100644 index 000000000000..822a704b192b --- /dev/null +++ b/packages/local_auth/local_auth_android/android/src/test/kotlin/io/flutter/plugins/localauth/TestResultUtils.kt @@ -0,0 +1,35 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.localauth + +/** Wraps Kotlin Result for use in Java unit tests. */ +@Suppress("UNCHECKED_CAST") +class ResultCompat(private val result: Result) { + private val value: T? = result.getOrNull() + private val exception = result.exceptionOrNull() + val isSuccess = result.isSuccess + val isFailure = result.isFailure + + companion object { + @JvmStatic + fun success(value: T, callback: Any) { + val castedCallback: (Result) -> Unit = callback as (Result) -> Unit + castedCallback(Result.success(value)) + } + + @JvmStatic + fun asCompatCallback(result: (ResultCompat) -> Unit): (Result) -> Unit { + return { result(ResultCompat(it)) } + } + } + + fun getOrNull(): T? { + return value + } + + fun exceptionOrNull(): Throwable? { + return exception + } +} diff --git a/packages/local_auth/local_auth_android/lib/src/messages.g.dart b/packages/local_auth/local_auth_android/lib/src/messages.g.dart index fae25d17019f..a0f627154aee 100644 --- a/packages/local_auth/local_auth_android/lib/src/messages.g.dart +++ b/packages/local_auth/local_auth_android/lib/src/messages.g.dart @@ -1,21 +1,40 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. +// Autogenerated from Pigeon (v26.2.3), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; - -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; + +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } bool _deepEquals(Object? a, Object? b) { @@ -272,10 +291,10 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : AuthResultCode.values[value]; case 130: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : AuthClassification.values[value]; case 131: return AuthStrings.decode(readValue(buffer)!); @@ -308,65 +327,43 @@ class LocalAuthApi { /// Returns true if this device supports authentication. Future isDeviceSupported() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.local_auth_android.LocalAuthApi.isDeviceSupported$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Returns true if this device can support biometric authentication, whether /// any biometrics are enrolled or not. Future deviceCanSupportBiometrics() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.local_auth_android.LocalAuthApi.deviceCanSupportBiometrics$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Cancels any in-progress authentication. @@ -374,33 +371,22 @@ class LocalAuthApi { /// Returns true only if authentication was in progress, and was successfully /// cancelled. Future stopAuthentication() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.local_auth_android.LocalAuthApi.stopAuthentication$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Returns the biometric types that are enrolled, and can thus be used @@ -409,29 +395,22 @@ class LocalAuthApi { /// Returns null if there is no activity, in which case the enrolled /// biometrics can't be determined. Future?> getEnrolledBiometrics() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.local_auth_android.LocalAuthApi.getEnrolledBiometrics$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as List?) - ?.cast(); - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return (pigeonVar_replyValue as List?)?.cast(); } /// Attempts to authenticate the user with the provided [options], and using @@ -440,34 +419,23 @@ class LocalAuthApi { AuthOptions options, AuthStrings strings, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.local_auth_android.LocalAuthApi.authenticate$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [options, strings], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as AuthResult?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as AuthResult; } } diff --git a/packages/local_auth/local_auth_android/pigeons/messages.dart b/packages/local_auth/local_auth_android/pigeons/messages.dart index 698f012a3dcc..11c29b377e0e 100644 --- a/packages/local_auth/local_auth_android/pigeons/messages.dart +++ b/packages/local_auth/local_auth_android/pigeons/messages.dart @@ -7,8 +7,9 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/src/messages.g.dart', - javaOut: 'android/src/main/java/io/flutter/plugins/localauth/Messages.java', - javaOptions: JavaOptions(package: 'io.flutter.plugins.localauth'), + kotlinOut: + 'android/src/main/kotlin/io/flutter/plugins/localauth/Messages.kt', + kotlinOptions: KotlinOptions(package: 'io.flutter.plugins.localauth'), copyrightHeader: 'pigeons/copyright.txt', ), ) diff --git a/packages/local_auth/local_auth_android/pubspec.yaml b/packages/local_auth/local_auth_android/pubspec.yaml index a53ab31388ce..9854bdca01e8 100644 --- a/packages/local_auth/local_auth_android/pubspec.yaml +++ b/packages/local_auth/local_auth_android/pubspec.yaml @@ -2,7 +2,7 @@ name: local_auth_android description: Android implementation of the local_auth plugin. repository: https://github.com/flutter/packages/tree/main/packages/local_auth/local_auth_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22 -version: 2.0.7 +version: 2.0.8 environment: sdk: ^3.9.0 @@ -23,6 +23,7 @@ dependencies: flutter_plugin_android_lifecycle: ^2.0.1 intl: ">=0.17.0 <0.21.0" local_auth_platform_interface: ^1.1.0 + meta: ^1.10.0 dev_dependencies: build_runner: ^2.3.3 diff --git a/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java b/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java index 751c1f5dc3b0..b649738648ab 100644 --- a/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java +++ b/packages/pigeon/example/app/android/app/src/main/java/io/flutter/plugins/Messages.java @@ -421,6 +421,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -429,6 +430,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -437,6 +439,7 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ExampleHostApi { @@ -452,6 +455,7 @@ public interface ExampleHostApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Sets up an instance of `ExampleHostApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable ExampleHostApi api) { setUp(binaryMessenger, "", api); @@ -545,6 +549,7 @@ public void error(Throwable error) { } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class MessageFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java index 8b3825849e95..a21588a5c9df 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/main/java/com/example/alternate_language_test_plugin/CoreTests.java @@ -3012,6 +3012,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -3020,6 +3021,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -3028,6 +3030,7 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** * The core interface that each host language plugin must implement in platform_test integration * tests. @@ -3039,191 +3042,250 @@ public interface HostIntegrationCoreApi { * A no-op function taking no arguments and returning no value, to sanity test basic calling. */ void noop(); + /** Returns the passed object, to test serialization and deserialization. */ @NonNull AllTypes echoAllTypes(@NonNull AllTypes everything); + /** Returns an error, to test error handling. */ @Nullable Object throwError(); + /** Returns an error from a void function, to test error handling. */ void throwErrorFromVoid(); + /** Returns a Flutter error, to test error handling. */ @Nullable Object throwFlutterError(); + /** Returns passed in int. */ @NonNull Long echoInt(@NonNull Long anInt); + /** Returns passed in double. */ @NonNull Double echoDouble(@NonNull Double aDouble); + /** Returns the passed in boolean. */ @NonNull Boolean echoBool(@NonNull Boolean aBool); + /** Returns the passed in string. */ @NonNull String echoString(@NonNull String aString); + /** Returns the passed in Uint8List. */ @NonNull byte[] echoUint8List(@NonNull byte[] aUint8List); + /** Returns the passed in generic Object. */ @NonNull Object echoObject(@NonNull Object anObject); + /** Returns the passed list, to test serialization and deserialization. */ @NonNull List echoList(@NonNull List list); + /** Returns the passed list, to test serialization and deserialization. */ @NonNull List echoEnumList(@NonNull List enumList); + /** Returns the passed list, to test serialization and deserialization. */ @NonNull List echoClassList(@NonNull List classList); + /** Returns the passed list, to test serialization and deserialization. */ @NonNull List echoNonNullEnumList(@NonNull List enumList); + /** Returns the passed list, to test serialization and deserialization. */ @NonNull List echoNonNullClassList(@NonNull List classList); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoMap(@NonNull Map map); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoStringMap(@NonNull Map stringMap); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoIntMap(@NonNull Map intMap); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoEnumMap(@NonNull Map enumMap); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoClassMap(@NonNull Map classMap); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoNonNullStringMap(@NonNull Map stringMap); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoNonNullIntMap(@NonNull Map intMap); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoNonNullEnumMap(@NonNull Map enumMap); + /** Returns the passed map, to test serialization and deserialization. */ @NonNull Map echoNonNullClassMap(@NonNull Map classMap); + /** Returns the passed class to test nested class serialization and deserialization. */ @NonNull AllClassesWrapper echoClassWrapper(@NonNull AllClassesWrapper wrapper); + /** Returns the passed enum to test serialization and deserialization. */ @NonNull AnEnum echoEnum(@NonNull AnEnum anEnum); + /** Returns the passed enum to test serialization and deserialization. */ @NonNull AnotherEnum echoAnotherEnum(@NonNull AnotherEnum anotherEnum); + /** Returns the default string. */ @NonNull String echoNamedDefaultString(@NonNull String aString); + /** Returns passed in double. */ @NonNull Double echoOptionalDefaultDouble(@NonNull Double aDouble); + /** Returns passed in int. */ @NonNull Long echoRequiredInt(@NonNull Long anInt); + /** Returns the result of platform-side equality check. */ @NonNull Boolean areAllNullableTypesEqual(@NonNull AllNullableTypes a, @NonNull AllNullableTypes b); + /** Returns the platform-side hash code for the given object. */ @NonNull Long getAllNullableTypesHash(@NonNull AllNullableTypes value); + /** Returns the platform-side hash code for the given object. */ @NonNull Long getAllNullableTypesWithoutRecursionHash(@NonNull AllNullableTypesWithoutRecursion value); + /** Returns the passed object, to test serialization and deserialization. */ @Nullable AllNullableTypes echoAllNullableTypes(@Nullable AllNullableTypes everything); + /** Returns the passed object, to test serialization and deserialization. */ @Nullable AllNullableTypesWithoutRecursion echoAllNullableTypesWithoutRecursion( @Nullable AllNullableTypesWithoutRecursion everything); + /** * Returns the inner `aString` value from the wrapped object, to test sending of nested objects. */ @Nullable String extractNestedNullableString(@NonNull AllClassesWrapper wrapper); + /** * Returns the inner `aString` value from the wrapped object, to test sending of nested objects. */ @NonNull AllClassesWrapper createNestedNullableString(@Nullable String nullableString); + /** Returns passed in arguments of multiple types. */ @NonNull AllNullableTypes sendMultipleNullableTypes( @Nullable Boolean aNullableBool, @Nullable Long aNullableInt, @Nullable String aNullableString); + /** Returns passed in arguments of multiple types. */ @NonNull AllNullableTypesWithoutRecursion sendMultipleNullableTypesWithoutRecursion( @Nullable Boolean aNullableBool, @Nullable Long aNullableInt, @Nullable String aNullableString); + /** Returns passed in int. */ @Nullable Long echoNullableInt(@Nullable Long aNullableInt); + /** Returns passed in double. */ @Nullable Double echoNullableDouble(@Nullable Double aNullableDouble); + /** Returns the passed in boolean. */ @Nullable Boolean echoNullableBool(@Nullable Boolean aNullableBool); + /** Returns the passed in string. */ @Nullable String echoNullableString(@Nullable String aNullableString); + /** Returns the passed in Uint8List. */ @Nullable byte[] echoNullableUint8List(@Nullable byte[] aNullableUint8List); + /** Returns the passed in generic Object. */ @Nullable Object echoNullableObject(@Nullable Object aNullableObject); + /** Returns the passed list, to test serialization and deserialization. */ @Nullable List echoNullableList(@Nullable List aNullableList); + /** Returns the passed list, to test serialization and deserialization. */ @Nullable List echoNullableEnumList(@Nullable List enumList); + /** Returns the passed list, to test serialization and deserialization. */ @Nullable List echoNullableClassList(@Nullable List classList); + /** Returns the passed list, to test serialization and deserialization. */ @Nullable List echoNullableNonNullEnumList(@Nullable List enumList); + /** Returns the passed list, to test serialization and deserialization. */ @Nullable List echoNullableNonNullClassList(@Nullable List classList); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableMap(@Nullable Map map); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableStringMap(@Nullable Map stringMap); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableIntMap(@Nullable Map intMap); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableEnumMap(@Nullable Map enumMap); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableClassMap( @Nullable Map classMap); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableNonNullStringMap(@Nullable Map stringMap); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableNonNullIntMap(@Nullable Map intMap); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableNonNullEnumMap(@Nullable Map enumMap); + /** Returns the passed map, to test serialization and deserialization. */ @Nullable Map echoNullableNonNullClassMap( @@ -3234,122 +3296,165 @@ Map echoNullableNonNullClassMap( @Nullable AnotherEnum echoAnotherNullableEnum(@Nullable AnotherEnum anotherEnum); + /** Returns passed in int. */ @Nullable Long echoOptionalNullableInt(@Nullable Long aNullableInt); + /** Returns the passed in string. */ @Nullable String echoNamedNullableString(@Nullable String aNullableString); + /** * A no-op function taking no arguments and returning no value, to sanity test basic * asynchronous calling. */ void noopAsync(@NonNull VoidResult result); + /** Returns passed in int asynchronously. */ void echoAsyncInt(@NonNull Long anInt, @NonNull Result result); + /** Returns passed in double asynchronously. */ void echoAsyncDouble(@NonNull Double aDouble, @NonNull Result result); + /** Returns the passed in boolean asynchronously. */ void echoAsyncBool(@NonNull Boolean aBool, @NonNull Result result); + /** Returns the passed string asynchronously. */ void echoAsyncString(@NonNull String aString, @NonNull Result result); + /** Returns the passed in Uint8List asynchronously. */ void echoAsyncUint8List(@NonNull byte[] aUint8List, @NonNull Result result); + /** Returns the passed in generic Object asynchronously. */ void echoAsyncObject(@NonNull Object anObject, @NonNull Result result); + /** Returns the passed list, to test asynchronous serialization and deserialization. */ void echoAsyncList(@NonNull List list, @NonNull Result> result); + /** Returns the passed list, to test asynchronous serialization and deserialization. */ void echoAsyncEnumList(@NonNull List enumList, @NonNull Result> result); + /** Returns the passed list, to test asynchronous serialization and deserialization. */ void echoAsyncClassList( @NonNull List classList, @NonNull Result> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncMap( @NonNull Map map, @NonNull Result> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncStringMap( @NonNull Map stringMap, @NonNull Result> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncIntMap(@NonNull Map intMap, @NonNull Result> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncEnumMap( @NonNull Map enumMap, @NonNull Result> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncClassMap( @NonNull Map classMap, @NonNull Result> result); + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ void echoAsyncEnum(@NonNull AnEnum anEnum, @NonNull Result result); + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ void echoAnotherAsyncEnum( @NonNull AnotherEnum anotherEnum, @NonNull Result result); + /** Responds with an error from an async function returning a value. */ void throwAsyncError(@NonNull NullableResult result); + /** Responds with an error from an async void function. */ void throwAsyncErrorFromVoid(@NonNull VoidResult result); + /** Responds with a Flutter error from an async function returning a value. */ void throwAsyncFlutterError(@NonNull NullableResult result); + /** Returns the passed object, to test async serialization and deserialization. */ void echoAsyncAllTypes(@NonNull AllTypes everything, @NonNull Result result); + /** Returns the passed object, to test serialization and deserialization. */ void echoAsyncNullableAllNullableTypes( @Nullable AllNullableTypes everything, @NonNull NullableResult result); + /** Returns the passed object, to test serialization and deserialization. */ void echoAsyncNullableAllNullableTypesWithoutRecursion( @Nullable AllNullableTypesWithoutRecursion everything, @NonNull NullableResult result); + /** Returns passed in int asynchronously. */ void echoAsyncNullableInt(@Nullable Long anInt, @NonNull NullableResult result); + /** Returns passed in double asynchronously. */ void echoAsyncNullableDouble(@Nullable Double aDouble, @NonNull NullableResult result); + /** Returns the passed in boolean asynchronously. */ void echoAsyncNullableBool(@Nullable Boolean aBool, @NonNull NullableResult result); + /** Returns the passed string asynchronously. */ void echoAsyncNullableString(@Nullable String aString, @NonNull NullableResult result); + /** Returns the passed in Uint8List asynchronously. */ void echoAsyncNullableUint8List( @Nullable byte[] aUint8List, @NonNull NullableResult result); + /** Returns the passed in generic Object asynchronously. */ void echoAsyncNullableObject(@Nullable Object anObject, @NonNull NullableResult result); + /** Returns the passed list, to test asynchronous serialization and deserialization. */ void echoAsyncNullableList( @Nullable List list, @NonNull NullableResult> result); + /** Returns the passed list, to test asynchronous serialization and deserialization. */ void echoAsyncNullableEnumList( @Nullable List enumList, @NonNull NullableResult> result); + /** Returns the passed list, to test asynchronous serialization and deserialization. */ void echoAsyncNullableClassList( @Nullable List classList, @NonNull NullableResult> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncNullableMap( @Nullable Map map, @NonNull NullableResult> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncNullableStringMap( @Nullable Map stringMap, @NonNull NullableResult> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncNullableIntMap( @Nullable Map intMap, @NonNull NullableResult> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncNullableEnumMap( @Nullable Map enumMap, @NonNull NullableResult> result); + /** Returns the passed map, to test asynchronous serialization and deserialization. */ void echoAsyncNullableClassMap( @Nullable Map classMap, @NonNull NullableResult> result); + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ void echoAsyncNullableEnum(@Nullable AnEnum anEnum, @NonNull NullableResult result); + /** Returns the passed enum, to test asynchronous serialization and deserialization. */ void echoAnotherAsyncNullableEnum( @Nullable AnotherEnum anotherEnum, @NonNull NullableResult result); + /** * Returns true if the handler is run on a main thread, which should be true since there is no * TaskQueue annotation. */ @NonNull Boolean defaultIsMainThread(); + /** * Returns true if the handler is run on a non-main thread, which should be true for any * platform with TaskQueue support. @@ -3516,6 +3621,7 @@ void callFlutterEchoAnotherNullableEnum( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * Sets up an instance of `HostIntegrationCoreApi` to handle messages through the * `binaryMessenger`. @@ -8059,6 +8165,7 @@ public void error(Throwable error) { } } } + /** * The core interface that the Dart platform_test code implements for host integration tests to * call into. @@ -8083,6 +8190,7 @@ public FlutterIntegrationCoreApi( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * A no-op function taking no arguments and returning no value, to sanity test basic calling. */ @@ -8109,6 +8217,7 @@ public void noop(@NonNull VoidResult result) { } }); } + /** Responds with an error from an async function returning a value. */ public void throwError(@NonNull NullableResult result) { final String channelName = @@ -8135,6 +8244,7 @@ public void throwError(@NonNull NullableResult result) { } }); } + /** Responds with an error from an async void function. */ public void throwErrorFromVoid(@NonNull VoidResult result) { final String channelName = @@ -8159,6 +8269,7 @@ public void throwErrorFromVoid(@NonNull VoidResult result) { } }); } + /** Returns the passed object, to test serialization and deserialization. */ public void echoAllTypes(@NonNull AllTypes everythingArg, @NonNull Result result) { final String channelName = @@ -8191,6 +8302,7 @@ public void echoAllTypes(@NonNull AllTypes everythingArg, @NonNull Result result) { final String channelName = @@ -8361,6 +8477,7 @@ public void echoBool(@NonNull Boolean aBoolArg, @NonNull Result result) } }); } + /** Returns the passed int, to test serialization and deserialization. */ public void echoInt(@NonNull Long anIntArg, @NonNull Result result) { final String channelName = @@ -8393,6 +8510,7 @@ public void echoInt(@NonNull Long anIntArg, @NonNull Result result) { } }); } + /** Returns the passed double, to test serialization and deserialization. */ public void echoDouble(@NonNull Double aDoubleArg, @NonNull Result result) { final String channelName = @@ -8425,6 +8543,7 @@ public void echoDouble(@NonNull Double aDoubleArg, @NonNull Result resul } }); } + /** Returns the passed string, to test serialization and deserialization. */ public void echoString(@NonNull String aStringArg, @NonNull Result result) { final String channelName = @@ -8457,6 +8576,7 @@ public void echoString(@NonNull String aStringArg, @NonNull Result resul } }); } + /** Returns the passed byte list, to test serialization and deserialization. */ public void echoUint8List(@NonNull byte[] listArg, @NonNull Result result) { final String channelName = @@ -8489,6 +8609,7 @@ public void echoUint8List(@NonNull byte[] listArg, @NonNull Result resul } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoList(@NonNull List listArg, @NonNull Result> result) { final String channelName = @@ -8521,6 +8642,7 @@ public void echoList(@NonNull List listArg, @NonNull Result } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoEnumList( @NonNull List enumListArg, @NonNull Result> result) { @@ -8554,6 +8676,7 @@ public void echoEnumList( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoClassList( @NonNull List classListArg, @@ -8588,6 +8711,7 @@ public void echoClassList( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoNonNullEnumList( @NonNull List enumListArg, @NonNull Result> result) { @@ -8621,6 +8745,7 @@ public void echoNonNullEnumList( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoNonNullClassList( @NonNull List classListArg, @@ -8655,6 +8780,7 @@ public void echoNonNullClassList( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoMap( @NonNull Map mapArg, @NonNull Result> result) { @@ -8688,6 +8814,7 @@ public void echoMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoStringMap( @NonNull Map stringMapArg, @NonNull Result> result) { @@ -8721,6 +8848,7 @@ public void echoStringMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoIntMap( @NonNull Map intMapArg, @NonNull Result> result) { @@ -8754,6 +8882,7 @@ public void echoIntMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoEnumMap( @NonNull Map enumMapArg, @NonNull Result> result) { @@ -8787,6 +8916,7 @@ public void echoEnumMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoClassMap( @NonNull Map classMapArg, @@ -8821,6 +8951,7 @@ public void echoClassMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNonNullStringMap( @NonNull Map stringMapArg, @NonNull Result> result) { @@ -8854,6 +8985,7 @@ public void echoNonNullStringMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNonNullIntMap( @NonNull Map intMapArg, @NonNull Result> result) { @@ -8887,6 +9019,7 @@ public void echoNonNullIntMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNonNullEnumMap( @NonNull Map enumMapArg, @NonNull Result> result) { @@ -8920,6 +9053,7 @@ public void echoNonNullEnumMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNonNullClassMap( @NonNull Map classMapArg, @@ -8954,6 +9088,7 @@ public void echoNonNullClassMap( } }); } + /** Returns the passed enum to test serialization and deserialization. */ public void echoEnum(@NonNull AnEnum anEnumArg, @NonNull Result result) { final String channelName = @@ -8986,6 +9121,7 @@ public void echoEnum(@NonNull AnEnum anEnumArg, @NonNull Result result) } }); } + /** Returns the passed enum to test serialization and deserialization. */ public void echoAnotherEnum( @NonNull AnotherEnum anotherEnumArg, @NonNull Result result) { @@ -9019,6 +9155,7 @@ public void echoAnotherEnum( } }); } + /** Returns the passed boolean, to test serialization and deserialization. */ public void echoNullableBool( @Nullable Boolean aBoolArg, @NonNull NullableResult result) { @@ -9046,6 +9183,7 @@ public void echoNullableBool( } }); } + /** Returns the passed int, to test serialization and deserialization. */ public void echoNullableInt(@Nullable Long anIntArg, @NonNull NullableResult result) { final String channelName = @@ -9072,6 +9210,7 @@ public void echoNullableInt(@Nullable Long anIntArg, @NonNull NullableResult result) { @@ -9099,6 +9238,7 @@ public void echoNullableDouble( } }); } + /** Returns the passed string, to test serialization and deserialization. */ public void echoNullableString( @Nullable String aStringArg, @NonNull NullableResult result) { @@ -9126,6 +9266,7 @@ public void echoNullableString( } }); } + /** Returns the passed byte list, to test serialization and deserialization. */ public void echoNullableUint8List( @Nullable byte[] listArg, @NonNull NullableResult result) { @@ -9153,6 +9294,7 @@ public void echoNullableUint8List( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoNullableList( @Nullable List listArg, @NonNull NullableResult> result) { @@ -9180,6 +9322,7 @@ public void echoNullableList( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoNullableEnumList( @Nullable List enumListArg, @NonNull NullableResult> result) { @@ -9207,6 +9350,7 @@ public void echoNullableEnumList( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoNullableClassList( @Nullable List classListArg, @@ -9235,6 +9379,7 @@ public void echoNullableClassList( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoNullableNonNullEnumList( @Nullable List enumListArg, @NonNull NullableResult> result) { @@ -9262,6 +9407,7 @@ public void echoNullableNonNullEnumList( } }); } + /** Returns the passed list, to test serialization and deserialization. */ public void echoNullableNonNullClassList( @Nullable List classListArg, @@ -9290,6 +9436,7 @@ public void echoNullableNonNullClassList( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableMap( @Nullable Map mapArg, @NonNull NullableResult> result) { @@ -9317,6 +9464,7 @@ public void echoNullableMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableStringMap( @Nullable Map stringMapArg, @@ -9345,6 +9493,7 @@ public void echoNullableStringMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableIntMap( @Nullable Map intMapArg, @NonNull NullableResult> result) { @@ -9372,6 +9521,7 @@ public void echoNullableIntMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableEnumMap( @Nullable Map enumMapArg, @@ -9400,6 +9550,7 @@ public void echoNullableEnumMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableClassMap( @Nullable Map classMapArg, @@ -9428,6 +9579,7 @@ public void echoNullableClassMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableNonNullStringMap( @Nullable Map stringMapArg, @@ -9456,6 +9608,7 @@ public void echoNullableNonNullStringMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableNonNullIntMap( @Nullable Map intMapArg, @NonNull NullableResult> result) { @@ -9483,6 +9636,7 @@ public void echoNullableNonNullIntMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableNonNullEnumMap( @Nullable Map enumMapArg, @@ -9511,6 +9665,7 @@ public void echoNullableNonNullEnumMap( } }); } + /** Returns the passed map, to test serialization and deserialization. */ public void echoNullableNonNullClassMap( @Nullable Map classMapArg, @@ -9539,6 +9694,7 @@ public void echoNullableNonNullClassMap( } }); } + /** Returns the passed enum to test serialization and deserialization. */ public void echoNullableEnum( @Nullable AnEnum anEnumArg, @NonNull NullableResult result) { @@ -9566,6 +9722,7 @@ public void echoNullableEnum( } }); } + /** Returns the passed enum to test serialization and deserialization. */ public void echoAnotherNullableEnum( @Nullable AnotherEnum anotherEnumArg, @NonNull NullableResult result) { @@ -9593,6 +9750,7 @@ public void echoAnotherNullableEnum( } }); } + /** * A no-op function taking no arguments and returning no value, to sanity test basic * asynchronous calling. @@ -9620,6 +9778,7 @@ public void noopAsync(@NonNull VoidResult result) { } }); } + /** Returns the passed in generic Object asynchronously. */ public void echoAsyncString(@NonNull String aStringArg, @NonNull Result result) { final String channelName = @@ -9653,6 +9812,7 @@ public void echoAsyncString(@NonNull String aStringArg, @NonNull Result }); } } + /** * An API that can be implemented for minimal, compile-only tests. * @@ -9666,6 +9826,7 @@ public interface HostTrivialApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Sets up an instance of `HostTrivialApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable HostTrivialApi api) { setUp(binaryMessenger, "", api); @@ -9701,6 +9862,7 @@ static void setUp( } } } + /** * A simple API implemented in some unit tests. * @@ -9716,6 +9878,7 @@ public interface HostSmallApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Sets up an instance of `HostSmallApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable HostSmallApi api) { setUp(binaryMessenger, "", api); @@ -9790,6 +9953,7 @@ public void error(Throwable error) { } } } + /** * A simple API called in some unit tests. * diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NonNullFieldsTest.java b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NonNullFieldsTest.java index d2598d5c0f9d..0d398247b8ce 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NonNullFieldsTest.java +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/src/test/java/com/example/alternate_language_test_plugin/NonNullFieldsTest.java @@ -7,7 +7,6 @@ import static org.junit.Assert.*; import com.example.alternate_language_test_plugin.NonNullFields.NonNullFieldSearchRequest; -import java.lang.IllegalStateException; import org.junit.Test; public class NonNullFieldsTest { diff --git a/packages/pigeon/tool/shared/test_suites.dart b/packages/pigeon/tool/shared/test_suites.dart index fe86925792aa..993f276ecd3d 100644 --- a/packages/pigeon/tool/shared/test_suites.dart +++ b/packages/pigeon/tool/shared/test_suites.dart @@ -359,8 +359,8 @@ Future _runIOSPluginUnitTests(String testPluginPath) async { const deviceName = 'Pigeon-Test-iPhone'; const deviceType = 'com.apple.CoreSimulator.SimDeviceType.iPhone-14'; - const deviceRuntime = 'com.apple.CoreSimulator.SimRuntime.iOS-18-2'; - const deviceOS = '18.2'; + const deviceRuntime = 'com.apple.CoreSimulator.SimRuntime.iOS-26-2'; + const deviceOS = '26.2'; await _createSimulator(deviceName, deviceType, deviceRuntime); return runXcodeBuild( '$examplePath/ios', diff --git a/packages/quick_actions/quick_actions_android/CHANGELOG.md b/packages/quick_actions/quick_actions_android/CHANGELOG.md index fcacbb356d3c..e7855a7e80ce 100644 --- a/packages/quick_actions/quick_actions_android/CHANGELOG.md +++ b/packages/quick_actions/quick_actions_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.29 + +* Simplifies thread handling in message responses. + ## 1.0.28 * Updates build files from Groovy to Kotlin. diff --git a/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/Messages.java b/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/Messages.java index 8b5af38eb85d..35b4387ebfe9 100644 --- a/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/Messages.java +++ b/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/Messages.java @@ -229,6 +229,7 @@ public interface Result { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for nullable API method returns. */ public interface NullableResult { /** Success case callback method for handling returns. */ @@ -237,6 +238,7 @@ public interface NullableResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Asynchronous error handling return type for void API method returns. */ public interface VoidResult { /** Success case callback method for handling returns. */ @@ -245,13 +247,16 @@ public interface VoidResult { /** Failure case callback method for handling errors. */ void error(@NonNull Throwable error); } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface AndroidQuickActionsApi { /** Checks for, and returns the action that launched the app. */ @Nullable String getLaunchAction(); + /** Sets the dynamic shortcuts for the app. */ void setShortcutItems(@NonNull List itemsList, @NonNull VoidResult result); + /** Removes all dynamic shortcuts. */ void clearShortcutItems(); @@ -259,6 +264,7 @@ public interface AndroidQuickActionsApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * Sets up an instance of `AndroidQuickActionsApi` to handle messages through the * `binaryMessenger`. @@ -353,6 +359,7 @@ public void error(Throwable error) { } } } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class AndroidQuickActionsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -372,6 +379,7 @@ public AndroidQuickActionsFlutterApi( static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** Sends a string representing a shortcut from the native platform to the app. */ public void launchAction(@NonNull String actionArg, @NonNull VoidResult result) { final String channelName = diff --git a/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/QuickActions.java b/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/QuickActions.java index 0890399b58c0..c3b337d5b033 100644 --- a/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/QuickActions.java +++ b/packages/quick_actions/quick_actions_android/android/src/main/java/io/flutter/plugins/quickactions/QuickActions.java @@ -11,8 +11,6 @@ import android.content.Intent; import android.content.res.Resources; import android.os.Build; -import android.os.Handler; -import android.os.Looper; import androidx.annotation.ChecksSdkIntAtLeast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -24,7 +22,6 @@ import io.flutter.plugins.quickactions.Messages.ShortcutItemMessage; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.Executor; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -48,7 +45,8 @@ public Activity getActivity() { } // Returns true when running on a version of Android that supports quick actions. - // When this returns false, methods should silently no-op, per the documented behavior (see README.md). + // When this returns false, methods should silently no-op, per the documented behavior (see + // README.md). @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.N_MR1) boolean isVersionAllowed() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1; @@ -62,7 +60,6 @@ public void setShortcutItems( return; } List shortcuts = shortcutItemMessageToShortcutInfo(itemsList); - Executor uiThreadExecutor = new UiThreadExecutor(); ThreadPoolExecutor executor = new ThreadPoolExecutor(0, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>()); @@ -76,21 +73,15 @@ public void setShortcutItems( // Leave dynamicShortcutsSet as false } - final boolean didSucceed = dynamicShortcutsSet; - - // TODO(camsim99): Investigate removing all of the executor logic in favor of background channels. - uiThreadExecutor.execute( - () -> { - if (didSucceed) { - result.success(); - } else { - result.error( - new FlutterError( - "quick_action_setshortcutitems_failure", - "Exception thrown when setting dynamic shortcuts", - null)); - } - }); + if (dynamicShortcutsSet) { + result.success(); + } else { + result.error( + new FlutterError( + "quick_action_setshortcutitems_failure", + "Exception thrown when setting dynamic shortcuts", + null)); + } }); } @@ -177,13 +168,4 @@ private Intent getIntentToOpenMainActivity(String type) { .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); } - - static class UiThreadExecutor implements Executor { - private final Handler handler = new Handler(Looper.getMainLooper()); - - @Override - public void execute(Runnable command) { - handler.post(command); - } - } } diff --git a/packages/quick_actions/quick_actions_android/example/android/app/src/androidTest/java/io/flutter/plugins/quickactionsexample/QuickActionsTest.java b/packages/quick_actions/quick_actions_android/example/android/app/src/androidTest/java/io/flutter/plugins/quickactionsexample/QuickActionsTest.java index daa5c9aaa2ce..6eed13b30aaf 100644 --- a/packages/quick_actions/quick_actions_android/example/android/app/src/androidTest/java/io/flutter/plugins/quickactionsexample/QuickActionsTest.java +++ b/packages/quick_actions/quick_actions_android/example/android/app/src/androidTest/java/io/flutter/plugins/quickactionsexample/QuickActionsTest.java @@ -74,8 +74,7 @@ public void appShortcutsAreCreated() { assertEquals(expectedShortcuts.size(), dynamicShortcuts.size()); for (ShortcutInfo expectedShortcut : expectedShortcuts) { ShortcutInfo dynamicShortcut = - dynamicShortcuts - .stream() + dynamicShortcuts.stream() .filter(s -> s.getId().equals(expectedShortcut.getId())) .findFirst() .get(); @@ -94,8 +93,7 @@ public void appShortcutLaunchActivityAfterStarting() { (ShortcutManager) context.getSystemService(Context.SHORTCUT_SERVICE); List dynamicShortcuts = shortcutManager.getDynamicShortcuts(); ShortcutInfo dynamicShortcut = - dynamicShortcuts - .stream() + dynamicShortcuts.stream() .filter(s -> s.getId().equals(firstShortcut.getId())) .findFirst() .get(); diff --git a/packages/quick_actions/quick_actions_android/pubspec.yaml b/packages/quick_actions/quick_actions_android/pubspec.yaml index dd05368fd9de..da2333f0ad13 100644 --- a/packages/quick_actions/quick_actions_android/pubspec.yaml +++ b/packages/quick_actions/quick_actions_android/pubspec.yaml @@ -2,7 +2,7 @@ name: quick_actions_android description: An implementation for the Android platform of the Flutter `quick_actions` plugin. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 1.0.28 +version: 1.0.29 environment: sdk: ^3.9.0 diff --git a/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/LegacySharedPreferencesPlugin.java b/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/LegacySharedPreferencesPlugin.java index 4d4a2ce66c24..effdb5b319e7 100644 --- a/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/LegacySharedPreferencesPlugin.java +++ b/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/LegacySharedPreferencesPlugin.java @@ -32,9 +32,11 @@ public class LegacySharedPreferencesPlugin implements FlutterPlugin, SharedPreferencesApi { private static final String TAG = "SharedPreferencesPlugin"; private static final String SHARED_PREFERENCES_NAME = "FlutterSharedPreferences"; - // All identifiers must match the SharedPreferencesPlugin.kt file, as well as the strings.dart file. + // All identifiers must match the SharedPreferencesPlugin.kt file, as well as the strings.dart + // file. private static final String LIST_IDENTIFIER = "VGhpcyBpcyB0aGUgcHJlZml4IGZvciBhIGxpc3Qu"; - // The symbol `!` was chosen as it cannot be created by the base 64 encoding used with LIST_IDENTIFIER. + // The symbol `!` was chosen as it cannot be created by the base 64 encoding used with + // LIST_IDENTIFIER. private static final String JSON_LIST_IDENTIFIER = LIST_IDENTIFIER + "!"; private static final String BIG_INTEGER_PREFIX = "VGhpcyBpcyB0aGUgcHJlZml4IGZvciBCaWdJbnRlZ2Vy"; private static final String DOUBLE_PREFIX = "VGhpcyBpcyB0aGUgcHJlZml4IGZvciBEb3VibGUu"; @@ -77,12 +79,14 @@ public void onDetachedFromEngine(@NonNull FlutterPlugin.FlutterPluginBinding bin @Override public @NonNull Boolean setString(@NonNull String key, @NonNull String value) { - // TODO (tarrinneal): Move this string prefix checking logic to dart code and make it an Argument Error. + // TODO (tarrinneal): Move this string prefix checking logic to dart code and make it an + // Argument Error. if (value.startsWith(LIST_IDENTIFIER) || value.startsWith(BIG_INTEGER_PREFIX) || value.startsWith(DOUBLE_PREFIX)) { throw new RuntimeException( - "StorageError: This string cannot be stored as it clashes with special identifier prefixes"); + "StorageError: This string cannot be stored as it clashes with special identifier" + + " prefixes"); } return preferences.edit().putString(key, value).commit(); } diff --git a/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/Messages.java b/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/Messages.java index 446776d7167e..4abdb0beaec2 100644 --- a/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/Messages.java +++ b/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/Messages.java @@ -82,21 +82,27 @@ public interface SharedPreferencesApi { /** Removes property from shared preferences data set. */ @NonNull Boolean remove(@NonNull String key); + /** Adds property to shared preferences data set of type bool. */ @NonNull Boolean setBool(@NonNull String key, @NonNull Boolean value); + /** Adds property to shared preferences data set of type String. */ @NonNull Boolean setString(@NonNull String key, @NonNull String value); + /** Adds property to shared preferences data set of type int. */ @NonNull Boolean setInt(@NonNull String key, @NonNull Long value); + /** Adds property to shared preferences data set of type double. */ @NonNull Boolean setDouble(@NonNull String key, @NonNull Double value); + /** Adds property to shared preferences data set of type List. */ @NonNull Boolean setEncodedStringList(@NonNull String key, @NonNull String value); + /** * Adds property to shared preferences data set of type List. * @@ -104,9 +110,11 @@ public interface SharedPreferencesApi { */ @NonNull Boolean setDeprecatedStringList(@NonNull String key, @NonNull List value); + /** Removes all properties from shared preferences data set with matching prefix. */ @NonNull Boolean clear(@NonNull String prefix, @Nullable List allowList); + /** Gets all properties from shared preferences data set with matching prefix. */ @NonNull Map getAll(@NonNull String prefix, @Nullable List allowList); @@ -115,6 +123,7 @@ public interface SharedPreferencesApi { static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } + /** * Sets up an instance of `SharedPreferencesApi` to handle messages through the * `binaryMessenger`. diff --git a/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/SharedPreferencesListEncoder.java b/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/SharedPreferencesListEncoder.java index 59cbb6db4187..f49cab3670b0 100644 --- a/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/SharedPreferencesListEncoder.java +++ b/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/SharedPreferencesListEncoder.java @@ -15,6 +15,7 @@ public interface SharedPreferencesListEncoder { /** Converts list to String for storing in shared preferences. */ @NonNull String encode(@NonNull List list); + /** Converts stored String representing List to List. */ @NonNull List decode(@NonNull String listString); diff --git a/packages/url_launcher/url_launcher_android/CHANGELOG.md b/packages/url_launcher/url_launcher_android/CHANGELOG.md index 2cb8a74f5f26..7c29e3267872 100644 --- a/packages/url_launcher/url_launcher_android/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.3.30 + +* Updates internal implementation to use Kotlin Pigeon. + ## 6.3.29 * Updates build files from Groovy to Kotlin. diff --git a/packages/url_launcher/url_launcher_android/android/build.gradle.kts b/packages/url_launcher/url_launcher_android/android/build.gradle.kts index 70044901998b..071bce13b0db 100644 --- a/packages/url_launcher/url_launcher_android/android/build.gradle.kts +++ b/packages/url_launcher/url_launcher_android/android/build.gradle.kts @@ -1,7 +1,10 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + group = "io.flutter.plugins.urllauncher" version = "1.0-SNAPSHOT" buildscript { + val kotlinVersion = "2.3.0" repositories { google() mavenCentral() @@ -9,6 +12,7 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:8.13.1") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") } } @@ -21,6 +25,13 @@ allprojects { plugins { id("com.android.library") + id("kotlin-android") +} + +kotlin { + compilerOptions { + jvmTarget = JvmTarget.fromTarget(JavaVersion.VERSION_17.toString()) + } } android { diff --git a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/Messages.java b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/Messages.java deleted file mode 100644 index be9d4c58a664..000000000000 --- a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/Messages.java +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -package io.flutter.plugins.urllauncher; - -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.CLASS; - -import android.util.Log; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MessageCodec; -import io.flutter.plugin.common.StandardMessageCodec; -import java.io.ByteArrayOutputStream; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Map; -import java.util.Objects; - -/** Generated class from Pigeon. */ -@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) -public class Messages { - - /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ - public static class FlutterError extends RuntimeException { - - /** The error code. */ - public final String code; - - /** The error details. Must be a datatype supported by the api codec. */ - public final Object details; - - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { - super(message); - this.code = code; - this.details = details; - } - } - - @NonNull - protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList<>(3); - if (exception instanceof FlutterError) { - FlutterError error = (FlutterError) exception; - errorList.add(error.code); - errorList.add(error.getMessage()); - errorList.add(error.details); - } else { - errorList.add(exception.toString()); - errorList.add(exception.getClass().getSimpleName()); - errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); - } - return errorList; - } - - @Target(METHOD) - @Retention(CLASS) - @interface CanIgnoreReturnValue {} - - /** - * Configuration options for an in-app WebView. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class WebViewOptions { - private @NonNull Boolean enableJavaScript; - - public @NonNull Boolean getEnableJavaScript() { - return enableJavaScript; - } - - public void setEnableJavaScript(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"enableJavaScript\" is null."); - } - this.enableJavaScript = setterArg; - } - - private @NonNull Boolean enableDomStorage; - - public @NonNull Boolean getEnableDomStorage() { - return enableDomStorage; - } - - public void setEnableDomStorage(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"enableDomStorage\" is null."); - } - this.enableDomStorage = setterArg; - } - - private @NonNull Map headers; - - public @NonNull Map getHeaders() { - return headers; - } - - public void setHeaders(@NonNull Map setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"headers\" is null."); - } - this.headers = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - WebViewOptions() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebViewOptions that = (WebViewOptions) o; - return enableJavaScript.equals(that.enableJavaScript) - && enableDomStorage.equals(that.enableDomStorage) - && headers.equals(that.headers); - } - - @Override - public int hashCode() { - return Objects.hash(enableJavaScript, enableDomStorage, headers); - } - - public static final class Builder { - - private @Nullable Boolean enableJavaScript; - - @CanIgnoreReturnValue - public @NonNull Builder setEnableJavaScript(@NonNull Boolean setterArg) { - this.enableJavaScript = setterArg; - return this; - } - - private @Nullable Boolean enableDomStorage; - - @CanIgnoreReturnValue - public @NonNull Builder setEnableDomStorage(@NonNull Boolean setterArg) { - this.enableDomStorage = setterArg; - return this; - } - - private @Nullable Map headers; - - @CanIgnoreReturnValue - public @NonNull Builder setHeaders(@NonNull Map setterArg) { - this.headers = setterArg; - return this; - } - - public @NonNull WebViewOptions build() { - WebViewOptions pigeonReturn = new WebViewOptions(); - pigeonReturn.setEnableJavaScript(enableJavaScript); - pigeonReturn.setEnableDomStorage(enableDomStorage); - pigeonReturn.setHeaders(headers); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(3); - toListResult.add(enableJavaScript); - toListResult.add(enableDomStorage); - toListResult.add(headers); - return toListResult; - } - - static @NonNull WebViewOptions fromList(@NonNull ArrayList pigeonVar_list) { - WebViewOptions pigeonResult = new WebViewOptions(); - Object enableJavaScript = pigeonVar_list.get(0); - pigeonResult.setEnableJavaScript((Boolean) enableJavaScript); - Object enableDomStorage = pigeonVar_list.get(1); - pigeonResult.setEnableDomStorage((Boolean) enableDomStorage); - Object headers = pigeonVar_list.get(2); - pigeonResult.setHeaders((Map) headers); - return pigeonResult; - } - } - - /** - * Configuration options for in-app browser views. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class BrowserOptions { - /** Whether or not to show the webpage title. */ - private @NonNull Boolean showTitle; - - public @NonNull Boolean getShowTitle() { - return showTitle; - } - - public void setShowTitle(@NonNull Boolean setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"showTitle\" is null."); - } - this.showTitle = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - BrowserOptions() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BrowserOptions that = (BrowserOptions) o; - return showTitle.equals(that.showTitle); - } - - @Override - public int hashCode() { - return Objects.hash(showTitle); - } - - public static final class Builder { - - private @Nullable Boolean showTitle; - - @CanIgnoreReturnValue - public @NonNull Builder setShowTitle(@NonNull Boolean setterArg) { - this.showTitle = setterArg; - return this; - } - - public @NonNull BrowserOptions build() { - BrowserOptions pigeonReturn = new BrowserOptions(); - pigeonReturn.setShowTitle(showTitle); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(showTitle); - return toListResult; - } - - static @NonNull BrowserOptions fromList(@NonNull ArrayList pigeonVar_list) { - BrowserOptions pigeonResult = new BrowserOptions(); - Object showTitle = pigeonVar_list.get(0); - pigeonResult.setShowTitle((Boolean) showTitle); - return pigeonResult; - } - } - - private static class PigeonCodec extends StandardMessageCodec { - public static final PigeonCodec INSTANCE = new PigeonCodec(); - - private PigeonCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 129: - return WebViewOptions.fromList((ArrayList) readValue(buffer)); - case (byte) 130: - return BrowserOptions.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof WebViewOptions) { - stream.write(129); - writeValue(stream, ((WebViewOptions) value).toList()); - } else if (value instanceof BrowserOptions) { - stream.write(130); - writeValue(stream, ((BrowserOptions) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface UrlLauncherApi { - /** Returns true if the URL can definitely be launched. */ - @NonNull - Boolean canLaunchUrl(@NonNull String url); - /** Opens the URL externally, returning true if successful. */ - @NonNull - Boolean launchUrl( - @NonNull String url, - @NonNull Map headers, - @NonNull Boolean requireNonBrowser); - /** - * Opens the URL in an in-app Custom Tab or WebView, returning true if it opens successfully. - */ - @NonNull - Boolean openUrlInApp( - @NonNull String url, - @NonNull Boolean allowCustomTab, - @NonNull WebViewOptions webViewOptions, - @NonNull BrowserOptions browserOptions); - - @NonNull - Boolean supportsCustomTabs(); - /** Closes the view opened by [openUrlInSafariViewController]. */ - void closeWebView(); - - /** The codec used by UrlLauncherApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** Sets up an instance of `UrlLauncherApi` to handle messages through the `binaryMessenger`. */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLauncherApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable UrlLauncherApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.canLaunchUrl" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String urlArg = (String) args.get(0); - try { - Boolean output = api.canLaunchUrl(urlArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.launchUrl" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String urlArg = (String) args.get(0); - Map headersArg = (Map) args.get(1); - Boolean requireNonBrowserArg = (Boolean) args.get(2); - try { - Boolean output = api.launchUrl(urlArg, headersArg, requireNonBrowserArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.openUrlInApp" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - String urlArg = (String) args.get(0); - Boolean allowCustomTabArg = (Boolean) args.get(1); - WebViewOptions webViewOptionsArg = (WebViewOptions) args.get(2); - BrowserOptions browserOptionsArg = (BrowserOptions) args.get(3); - try { - Boolean output = - api.openUrlInApp( - urlArg, allowCustomTabArg, webViewOptionsArg, browserOptionsArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.supportsCustomTabs" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - Boolean output = api.supportsCustomTabs(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.closeWebView" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - api.closeWebView(); - wrapped.add(0, null); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } -} diff --git a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncher.java b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncher.java index b3f962f31b12..2598ef054339 100644 --- a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncher.java +++ b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncher.java @@ -19,9 +19,6 @@ import androidx.annotation.VisibleForTesting; import androidx.browser.customtabs.CustomTabsClient; import androidx.browser.customtabs.CustomTabsIntent; -import io.flutter.plugins.urllauncher.Messages.BrowserOptions; -import io.flutter.plugins.urllauncher.Messages.UrlLauncherApi; -import io.flutter.plugins.urllauncher.Messages.WebViewOptions; import java.util.Collections; import java.util.Locale; import java.util.Map; @@ -65,7 +62,7 @@ void setActivity(@Nullable Activity activity) { } @Override - public @NonNull Boolean canLaunchUrl(@NonNull String url) { + public boolean canLaunchUrl(@NonNull String url) { Intent launchIntent = new Intent(Intent.ACTION_VIEW); launchIntent.setData(Uri.parse(url)); String componentName = intentResolver.getHandlerComponentName(launchIntent); @@ -81,10 +78,8 @@ void setActivity(@Nullable Activity activity) { } @Override - public @NonNull Boolean launchUrl( - @NonNull String url, - @NonNull Map headers, - @NonNull Boolean requireNonBrowser) { + public boolean launchUrl( + @NonNull String url, @NonNull Map headers, boolean requireNonBrowser) { ensureActivity(); assert activity != null; @@ -105,9 +100,9 @@ void setActivity(@Nullable Activity activity) { } @Override - public @NonNull Boolean openUrlInApp( + public boolean openUrlInApp( @NonNull String url, - @NonNull Boolean allowCustomTab, + boolean allowCustomTab, @NonNull WebViewOptions webViewOptions, @NonNull BrowserOptions browserOptions) { ensureActivity(); @@ -147,7 +142,7 @@ public void closeWebView() { } @Override - public @NonNull Boolean supportsCustomTabs() { + public boolean supportsCustomTabs() { return CustomTabsClient.getPackageName(applicationContext, Collections.emptyList()) != null; } @@ -196,7 +191,7 @@ private static boolean containsRestrictedHeader(Map headersMap) private void ensureActivity() { if (activity == null) { - throw new Messages.FlutterError( + throw new FlutterError( "NO_ACTIVITY", "Launching a URL requires a foreground activity.", null); } } diff --git a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncherPlugin.java b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncherPlugin.java index 6a7ad8d99a7e..3c6b7fe35bc2 100644 --- a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncherPlugin.java +++ b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/UrlLauncherPlugin.java @@ -23,7 +23,7 @@ public final class UrlLauncherPlugin implements FlutterPlugin, ActivityAware { @Override public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { urlLauncher = new UrlLauncher(binding.getApplicationContext()); - Messages.UrlLauncherApi.setUp(binding.getBinaryMessenger(), urlLauncher); + UrlLauncherApi.Companion.setUp(binding.getBinaryMessenger(), urlLauncher); } @Override @@ -33,7 +33,7 @@ public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { return; } - Messages.UrlLauncherApi.setUp(binding.getBinaryMessenger(), null); + UrlLauncherApi.Companion.setUp(binding.getBinaryMessenger(), null); urlLauncher = null; } diff --git a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java index 5ead043540cf..5f1b1aa628e8 100644 --- a/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java +++ b/packages/url_launcher/url_launcher_android/android/src/main/java/io/flutter/plugins/urllauncher/WebViewActivity.java @@ -106,7 +106,8 @@ public void onCreate(@Nullable Bundle savedInstanceState) { // Open new urls inside the webview itself. webview.setWebViewClient(webViewClient); - // Multi windows is set with FlutterWebChromeClient by default to handle internal bug: b/159892679. + // Multi windows is set with FlutterWebChromeClient by default to handle internal bug: + // b/159892679. webview.getSettings().setSupportMultipleWindows(true); webview.setWebChromeClient(new FlutterWebChromeClient()); diff --git a/packages/url_launcher/url_launcher_android/android/src/main/kotlin/io/flutter/plugins/urllauncher/Messages.kt b/packages/url_launcher/url_launcher_android/android/src/main/kotlin/io/flutter/plugins/urllauncher/Messages.kt new file mode 100644 index 000000000000..f1e41cbc8eeb --- /dev/null +++ b/packages/url_launcher/url_launcher_android/android/src/main/kotlin/io/flutter/plugins/urllauncher/Messages.kt @@ -0,0 +1,456 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") + +package io.flutter.plugins.urllauncher + +import android.util.Log +import io.flutter.plugin.common.BasicMessageChannel +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.MessageCodec +import io.flutter.plugin.common.StandardMessageCodec +import java.io.ByteArrayOutputStream +import java.nio.ByteBuffer + +private object MessagesPigeonUtils { + + fun wrapResult(result: Any?): List { + return listOf(result) + } + + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf(exception.code, exception.message, exception.details) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + } + } + + fun doubleEquals(a: Double, b: Double): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN()) + } + + fun floatEquals(a: Float, b: Float): Boolean { + // Normalize -0.0 to 0.0 and handle NaN equality. + return (if (a == 0.0f) 0.0f else a) == (if (b == 0.0f) 0.0f else b) || (a.isNaN() && b.isNaN()) + } + + fun doubleHash(d: Double): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (d == 0.0) 0.0 else d + val bits = java.lang.Double.doubleToLongBits(normalized) + return (bits xor (bits ushr 32)).toInt() + } + + fun floatHash(f: Float): Int { + // Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes. + val normalized = if (f == 0.0f) 0.0f else f + return java.lang.Float.floatToIntBits(normalized) + } + + fun deepEquals(a: Any?, b: Any?): Boolean { + if (a === b) { + return true + } + if (a == null || b == null) { + return false + } + if (a is ByteArray && b is ByteArray) { + return a.contentEquals(b) + } + if (a is IntArray && b is IntArray) { + return a.contentEquals(b) + } + if (a is LongArray && b is LongArray) { + return a.contentEquals(b) + } + if (a is DoubleArray && b is DoubleArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!doubleEquals(a[i], b[i])) return false + } + return true + } + if (a is FloatArray && b is FloatArray) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!floatEquals(a[i], b[i])) return false + } + return true + } + if (a is Array<*> && b is Array<*>) { + if (a.size != b.size) return false + for (i in a.indices) { + if (!deepEquals(a[i], b[i])) return false + } + return true + } + if (a is List<*> && b is List<*>) { + if (a.size != b.size) return false + val iterA = a.iterator() + val iterB = b.iterator() + while (iterA.hasNext() && iterB.hasNext()) { + if (!deepEquals(iterA.next(), iterB.next())) return false + } + return true + } + if (a is Map<*, *> && b is Map<*, *>) { + if (a.size != b.size) return false + for (entry in a) { + val key = entry.key + var found = false + for (bEntry in b) { + if (deepEquals(key, bEntry.key)) { + if (deepEquals(entry.value, bEntry.value)) { + found = true + break + } else { + return false + } + } + } + if (!found) return false + } + return true + } + if (a is Double && b is Double) { + return doubleEquals(a, b) + } + if (a is Float && b is Float) { + return floatEquals(a, b) + } + return a == b + } + + fun deepHash(value: Any?): Int { + return when (value) { + null -> 0 + is ByteArray -> value.contentHashCode() + is IntArray -> value.contentHashCode() + is LongArray -> value.contentHashCode() + is DoubleArray -> { + var result = 1 + for (item in value) { + result = 31 * result + doubleHash(item) + } + result + } + is FloatArray -> { + var result = 1 + for (item in value) { + result = 31 * result + floatHash(item) + } + result + } + is Array<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is List<*> -> { + var result = 1 + for (item in value) { + result = 31 * result + deepHash(item) + } + result + } + is Map<*, *> -> { + var result = 0 + for (entry in value) { + result += ((deepHash(entry.key) * 31) xor deepHash(entry.value)) + } + result + } + is Double -> doubleHash(value) + is Float -> floatHash(value) + else -> value.hashCode() + } + } +} + +/** + * Error class for passing custom error details to Flutter via a thrown PlatformException. + * + * @property code The error code. + * @property message The error message. + * @property details The error details. Must be a datatype supported by the api codec. + */ +class FlutterError( + val code: String, + override val message: String? = null, + val details: Any? = null +) : RuntimeException() + +/** + * Configuration options for an in-app WebView. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class WebViewOptions( + val enableJavaScript: Boolean, + val enableDomStorage: Boolean, + val headers: Map +) { + companion object { + fun fromList(pigeonVar_list: List): WebViewOptions { + val enableJavaScript = pigeonVar_list[0] as Boolean + val enableDomStorage = pigeonVar_list[1] as Boolean + val headers = pigeonVar_list[2] as Map + return WebViewOptions(enableJavaScript, enableDomStorage, headers) + } + } + + fun toList(): List { + return listOf( + enableJavaScript, + enableDomStorage, + headers, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as WebViewOptions + return MessagesPigeonUtils.deepEquals(this.enableJavaScript, other.enableJavaScript) && + MessagesPigeonUtils.deepEquals(this.enableDomStorage, other.enableDomStorage) && + MessagesPigeonUtils.deepEquals(this.headers, other.headers) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.enableJavaScript) + result = 31 * result + MessagesPigeonUtils.deepHash(this.enableDomStorage) + result = 31 * result + MessagesPigeonUtils.deepHash(this.headers) + return result + } +} + +/** + * Configuration options for in-app browser views. + * + * Generated class from Pigeon that represents data sent in messages. + */ +data class BrowserOptions( + /** Whether or not to show the webpage title. */ + val showTitle: Boolean +) { + companion object { + fun fromList(pigeonVar_list: List): BrowserOptions { + val showTitle = pigeonVar_list[0] as Boolean + return BrowserOptions(showTitle) + } + } + + fun toList(): List { + return listOf( + showTitle, + ) + } + + override fun equals(other: Any?): Boolean { + if (other == null || other.javaClass != javaClass) { + return false + } + if (this === other) { + return true + } + val other = other as BrowserOptions + return MessagesPigeonUtils.deepEquals(this.showTitle, other.showTitle) + } + + override fun hashCode(): Int { + var result = javaClass.hashCode() + result = 31 * result + MessagesPigeonUtils.deepHash(this.showTitle) + return result + } +} + +private open class MessagesPigeonCodec : StandardMessageCodec() { + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { + return when (type) { + 129.toByte() -> { + return (readValue(buffer) as? List)?.let { WebViewOptions.fromList(it) } + } + 130.toByte() -> { + return (readValue(buffer) as? List)?.let { BrowserOptions.fromList(it) } + } + else -> super.readValueOfType(type, buffer) + } + } + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + when (value) { + is WebViewOptions -> { + stream.write(129) + writeValue(stream, value.toList()) + } + is BrowserOptions -> { + stream.write(130) + writeValue(stream, value.toList()) + } + else -> super.writeValue(stream, value) + } + } +} + +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface UrlLauncherApi { + /** Returns true if the URL can definitely be launched. */ + fun canLaunchUrl(url: String): Boolean + /** Opens the URL externally, returning true if successful. */ + fun launchUrl(url: String, headers: Map, requireNonBrowser: Boolean): Boolean + /** Opens the URL in an in-app Custom Tab or WebView, returning true if it opens successfully. */ + fun openUrlInApp( + url: String, + allowCustomTab: Boolean, + webViewOptions: WebViewOptions, + browserOptions: BrowserOptions + ): Boolean + + fun supportsCustomTabs(): Boolean + /** Closes the view opened by [openUrlInSafariViewController]. */ + fun closeWebView() + + companion object { + /** The codec used by UrlLauncherApi. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + /** Sets up an instance of `UrlLauncherApi` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp( + binaryMessenger: BinaryMessenger, + api: UrlLauncherApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.canLaunchUrl$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val urlArg = args[0] as String + val wrapped: List = + try { + listOf(api.canLaunchUrl(urlArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.launchUrl$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val urlArg = args[0] as String + val headersArg = args[1] as Map + val requireNonBrowserArg = args[2] as Boolean + val wrapped: List = + try { + listOf(api.launchUrl(urlArg, headersArg, requireNonBrowserArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.openUrlInApp$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val urlArg = args[0] as String + val allowCustomTabArg = args[1] as Boolean + val webViewOptionsArg = args[2] as WebViewOptions + val browserOptionsArg = args[3] as BrowserOptions + val wrapped: List = + try { + listOf( + api.openUrlInApp( + urlArg, allowCustomTabArg, webViewOptionsArg, browserOptionsArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.supportsCustomTabs$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + listOf(api.supportsCustomTabs()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.closeWebView$separatedMessageChannelSuffix", + codec) + if (api != null) { + channel.setMessageHandler { _, reply -> + val wrapped: List = + try { + api.closeWebView() + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } + } + } +} diff --git a/packages/url_launcher/url_launcher_android/android/src/test/java/io/flutter/plugins/urllauncher/UrlLauncherTest.java b/packages/url_launcher/url_launcher_android/android/src/test/java/io/flutter/plugins/urllauncher/UrlLauncherTest.java index 45dc645c01db..efc56260936a 100644 --- a/packages/url_launcher/url_launcher_android/android/src/test/java/io/flutter/plugins/urllauncher/UrlLauncherTest.java +++ b/packages/url_launcher/url_launcher_android/android/src/test/java/io/flutter/plugins/urllauncher/UrlLauncherTest.java @@ -53,7 +53,7 @@ public void canLaunch_returnsTrue() { UrlLauncher api = new UrlLauncher(ApplicationProvider.getApplicationContext(), intent -> "some.component"); - Boolean result = api.canLaunchUrl("https://flutter.dev"); + boolean result = api.canLaunchUrl("https://flutter.dev"); assertTrue(result); } @@ -62,7 +62,7 @@ public void canLaunch_returnsTrue() { public void canLaunch_returnsFalse() { UrlLauncher api = new UrlLauncher(ApplicationProvider.getApplicationContext(), intent -> null); - Boolean result = api.canLaunchUrl("https://flutter.dev"); + boolean result = api.canLaunchUrl("https://flutter.dev"); assertFalse(result); } @@ -76,7 +76,7 @@ public void canLaunch_returnsFalseForEmulatorFallbackComponent() { ApplicationProvider.getApplicationContext(), intent -> "{com.android.fallback/com.android.fallback.Fallback}"); - Boolean result = api.canLaunchUrl("https://flutter.dev"); + boolean result = api.canLaunchUrl("https://flutter.dev"); assertFalse(result); } @@ -86,11 +86,10 @@ public void launch_throwsForNoCurrentActivity() { UrlLauncher api = new UrlLauncher(ApplicationProvider.getApplicationContext()); api.setActivity(null); - Messages.FlutterError exception = + FlutterError exception = assertThrows( - Messages.FlutterError.class, - () -> api.launchUrl("https://flutter.dev", new HashMap<>(), false)); - assertEquals("NO_ACTIVITY", exception.code); + FlutterError.class, () -> api.launchUrl("https://flutter.dev", new HashMap<>(), false)); + assertEquals("NO_ACTIVITY", exception.getCode()); } @Test @@ -113,7 +112,6 @@ public void launch_createsIntentWithPassedUrl() { @Test public void launch_setsRequireNonBrowserWhenRequested() { Activity activity = mock(Activity.class); - String url = "https://flutter.dev"; UrlLauncher api = new UrlLauncher(ApplicationProvider.getApplicationContext()); api.setActivity(activity); doThrow(new ActivityNotFoundException()).when(activity).startActivity(any()); @@ -166,12 +164,8 @@ public void openUrlInApp_opensUrlInWebViewIfNecessary() { api.openUrlInApp( url, true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(enableJavaScript) - .setEnableDomStorage(enableDomStorage) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(showTitle).build()); + new WebViewOptions(enableJavaScript, enableDomStorage, headers), + new BrowserOptions(showTitle)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture()); @@ -196,12 +190,8 @@ public void openWebView_opensUrlInWebViewIfRequested() { api.openUrlInApp( url, false, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(new HashMap<>()) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(true).build()); + new WebViewOptions(false, false, new HashMap<>()), + new BrowserOptions(true)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture()); @@ -220,12 +210,8 @@ public void openWebView_opensUrlInCustomTabs() { api.openUrlInApp( url, true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(new HashMap<>()) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + new WebViewOptions(false, false, new HashMap<>()), + new BrowserOptions(false)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture(), isNull()); @@ -246,14 +232,7 @@ public void openWebView_opensUrlInCustomTabsWithCORSAllowedHeader() { boolean result = api.openUrlInApp( - url, - true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + url, true, new WebViewOptions(false, false, headers), new BrowserOptions(false)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture(), isNull()); @@ -275,14 +254,7 @@ public void openWebView_opensUrlInCustomTabsWithShowTitle() { boolean result = api.openUrlInApp( - url, - true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(true).build()); + url, true, new WebViewOptions(false, false, headers), new BrowserOptions(true)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture(), isNull()); @@ -290,8 +262,8 @@ public void openWebView_opensUrlInCustomTabsWithShowTitle() { assertEquals(Intent.ACTION_VIEW, intentCaptor.getValue().getAction()); assertNull(intentCaptor.getValue().getComponent()); assertEquals( - intentCaptor.getValue().getExtras().getInt(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE), - CustomTabsIntent.SHOW_PAGE_TITLE); + CustomTabsIntent.SHOW_PAGE_TITLE, + intentCaptor.getValue().getExtras().getInt(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE)); } @Test @@ -304,14 +276,7 @@ public void openWebView_opensUrlInCustomTabsWithoutShowTitle() { boolean result = api.openUrlInApp( - url, - true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + url, true, new WebViewOptions(false, false, headers), new BrowserOptions(false)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture(), isNull()); @@ -319,8 +284,8 @@ public void openWebView_opensUrlInCustomTabsWithoutShowTitle() { assertEquals(Intent.ACTION_VIEW, intentCaptor.getValue().getAction()); assertNull(intentCaptor.getValue().getComponent()); assertEquals( - intentCaptor.getValue().getExtras().getInt(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE), - CustomTabsIntent.NO_TITLE); + CustomTabsIntent.NO_TITLE, + intentCaptor.getValue().getExtras().getInt(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE)); } @Test @@ -337,21 +302,15 @@ public void openWebView_fallsBackToWebViewIfCustomTabFails() { api.openUrlInApp( url, true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(new HashMap<>()) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + new WebViewOptions(false, false, new HashMap<>()), + new BrowserOptions(false)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture()); assertTrue(result); assertEquals(url, intentCaptor.getValue().getExtras().getString(WebViewActivity.URL_EXTRA)); - assertEquals( - false, intentCaptor.getValue().getExtras().getBoolean(WebViewActivity.ENABLE_JS_EXTRA)); - assertEquals( - false, intentCaptor.getValue().getExtras().getBoolean(WebViewActivity.ENABLE_DOM_EXTRA)); + assertFalse(intentCaptor.getValue().getExtras().getBoolean(WebViewActivity.ENABLE_JS_EXTRA)); + assertFalse(intentCaptor.getValue().getExtras().getBoolean(WebViewActivity.ENABLE_DOM_EXTRA)); } @Test @@ -366,12 +325,8 @@ public void openWebView_handlesEnableJavaScript() { api.openUrlInApp( "https://flutter.dev", true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(enableJavaScript) - .setEnableDomStorage(false) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + new WebViewOptions(enableJavaScript, false, headers), + new BrowserOptions(false)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture()); @@ -394,12 +349,8 @@ public void openWebView_handlesHeaders() { api.openUrlInApp( "https://flutter.dev", true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + new WebViewOptions(false, false, headers), + new BrowserOptions(false)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture()); @@ -422,12 +373,8 @@ public void openWebView_handlesEnableDomStorage() { api.openUrlInApp( "https://flutter.dev", true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(enableDomStorage) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + new WebViewOptions(false, enableDomStorage, headers), + new BrowserOptions(false)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture()); @@ -448,19 +395,15 @@ public void openWebView_handlesEnableShowTitle() { api.openUrlInApp( "https://flutter.dev", true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(enableDomStorage) - .setHeaders(headers) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(showTitle).build()); + new WebViewOptions(false, enableDomStorage, headers), + new BrowserOptions(showTitle)); final ArgumentCaptor intentCaptor = ArgumentCaptor.forClass(Intent.class); verify(activity).startActivity(intentCaptor.capture(), isNull()); assertEquals( - intentCaptor.getValue().getExtras().getInt(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE), - CustomTabsIntent.SHOW_PAGE_TITLE); + CustomTabsIntent.SHOW_PAGE_TITLE, + intentCaptor.getValue().getExtras().getInt(CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE)); } @Test @@ -468,20 +411,16 @@ public void openWebView_throwsForNoCurrentActivity() { UrlLauncher api = new UrlLauncher(ApplicationProvider.getApplicationContext()); api.setActivity(null); - Messages.FlutterError exception = + FlutterError exception = assertThrows( - Messages.FlutterError.class, + FlutterError.class, () -> api.openUrlInApp( "https://flutter.dev", true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(new HashMap<>()) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build())); - assertEquals("NO_ACTIVITY", exception.code); + new WebViewOptions(false, false, new HashMap<>()), + new BrowserOptions(false))); + assertEquals("NO_ACTIVITY", exception.getCode()); } @Test @@ -500,12 +439,8 @@ public void openWebView_returnsFalse() { api.openUrlInApp( "https://flutter.dev", true, - new Messages.WebViewOptions.Builder() - .setEnableJavaScript(false) - .setEnableDomStorage(false) - .setHeaders(new HashMap<>()) - .build(), - new Messages.BrowserOptions.Builder().setShowTitle(false).build()); + new WebViewOptions(false, false, new HashMap<>()), + new BrowserOptions(false)); assertFalse(result); } diff --git a/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart b/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart index 049813a94700..213dc8273f6f 100644 --- a/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart +++ b/packages/url_launcher/url_launcher_android/lib/src/messages.g.dart @@ -1,24 +1,52 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. +// Autogenerated from Pigeon (v26.3.4), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_import, unused_shown_name +// ignore_for_file: type=lint import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'dart:typed_data' show Float64List, Int32List, Int64List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } bool _deepEquals(Object? a, Object? b) { + if (identical(a, b)) { + return true; + } + if (a is double && b is double) { + if (a.isNaN && b.isNaN) { + return true; + } + return a == b; + } if (a is List && b is List) { return a.length == b.length && a.indexed.every( @@ -26,16 +54,52 @@ bool _deepEquals(Object? a, Object? b) { ); } if (a is Map && b is Map) { - return a.length == b.length && - a.entries.every( - (MapEntry entry) => - (b as Map).containsKey(entry.key) && - _deepEquals(entry.value, b[entry.key]), - ); + if (a.length != b.length) { + return false; + } + for (final MapEntry entryA in a.entries) { + bool found = false; + for (final MapEntry entryB in b.entries) { + if (_deepEquals(entryA.key, entryB.key)) { + if (_deepEquals(entryA.value, entryB.value)) { + found = true; + break; + } else { + return false; + } + } + } + if (!found) { + return false; + } + } + return true; } return a == b; } +int _deepHash(Object? value) { + if (value is List) { + return Object.hashAll(value.map(_deepHash)); + } + if (value is Map) { + int result = 0; + for (final MapEntry entry in value.entries) { + result += (_deepHash(entry.key) * 31) ^ _deepHash(entry.value); + } + return result; + } + if (value is double && value.isNaN) { + // Normalize NaN to a consistent hash. + return 0x7FF8000000000000.hashCode; + } + if (value is double && value == 0.0) { + // Normalize -0.0 to 0.0 so they have the same hash code. + return 0.0.hashCode; + } + return value.hashCode; +} + /// Configuration options for an in-app WebView. class WebViewOptions { WebViewOptions({ @@ -63,7 +127,7 @@ class WebViewOptions { return WebViewOptions( enableJavaScript: result[0]! as bool, enableDomStorage: result[1]! as bool, - headers: (result[2] as Map?)!.cast(), + headers: (result[2]! as Map).cast(), ); } @@ -76,12 +140,14 @@ class WebViewOptions { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(enableJavaScript, other.enableJavaScript) && + _deepEquals(enableDomStorage, other.enableDomStorage) && + _deepEquals(headers, other.headers); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } /// Configuration options for in-app browser views. @@ -113,12 +179,12 @@ class BrowserOptions { if (identical(this, other)) { return true; } - return _deepEquals(encode(), other.encode()); + return _deepEquals(showTitle, other.showTitle); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); + int get hashCode => _deepHash([runtimeType, ..._toList()]); } class _PigeonCodec extends StandardMessageCodec { @@ -171,35 +237,24 @@ class UrlLauncherApi { /// Returns true if the URL can definitely be launched. Future canLaunchUrl(String url) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.canLaunchUrl$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [url], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Opens the URL externally, returning true if successful. @@ -208,35 +263,24 @@ class UrlLauncherApi { Map headers, bool requireNonBrowser, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.launchUrl$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [url, headers, requireNonBrowser], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Opens the URL in an in-app Custom Tab or WebView, returning true if it @@ -247,90 +291,61 @@ class UrlLauncherApi { WebViewOptions webViewOptions, BrowserOptions browserOptions, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.openUrlInApp$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [url, allowCustomTab, webViewOptions, browserOptions], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } Future supportsCustomTabs() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.supportsCustomTabs$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! as bool; } /// Closes the view opened by [openUrlInSafariViewController]. Future closeWebView() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.closeWebView$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } } diff --git a/packages/url_launcher/url_launcher_android/pigeons/messages.dart b/packages/url_launcher/url_launcher_android/pigeons/messages.dart index bf10fbdd60ab..badef0ab2f16 100644 --- a/packages/url_launcher/url_launcher_android/pigeons/messages.dart +++ b/packages/url_launcher/url_launcher_android/pigeons/messages.dart @@ -7,9 +7,9 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon( PigeonOptions( dartOut: 'lib/src/messages.g.dart', - javaOptions: JavaOptions(package: 'io.flutter.plugins.urllauncher'), - javaOut: - 'android/src/main/java/io/flutter/plugins/urllauncher/Messages.java', + kotlinOut: + 'android/src/main/kotlin/io/flutter/plugins/urllauncher/Messages.kt', + kotlinOptions: KotlinOptions(package: 'io.flutter.plugins.urllauncher'), copyrightHeader: 'pigeons/copyright.txt', ), ) diff --git a/packages/url_launcher/url_launcher_android/pubspec.yaml b/packages/url_launcher/url_launcher_android/pubspec.yaml index 425b261484ae..2e676a118cd9 100644 --- a/packages/url_launcher/url_launcher_android/pubspec.yaml +++ b/packages/url_launcher/url_launcher_android/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher_android description: Android implementation of the url_launcher plugin. repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 6.3.29 +version: 6.3.30 environment: sdk: ^3.9.0 @@ -20,13 +20,14 @@ flutter: dependencies: flutter: sdk: flutter + meta: ^1.10.0 url_launcher_platform_interface: ^2.3.1 dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^26.1.0 + pigeon: ^26.3.4 plugin_platform_interface: ^2.1.7 test: ^1.16.3 diff --git a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java index 7cfb5c1c13be..ef661f7e1e97 100644 --- a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java +++ b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java @@ -55,8 +55,10 @@ public interface DisposeHandler { // TODO: Migrate to stable API, see https://github.com/flutter/flutter/issues/147039. @UnstableApi - // Error thrown for this-escape warning on JDK 21+ due to https://bugs.openjdk.org/browse/JDK-8015831. - // Keeping behavior as-is and addressing the warning could cause a regression: https://github.com/flutter/packages/pull/10193 + // Error thrown for this-escape warning on JDK 21+ due to + // https://bugs.openjdk.org/browse/JDK-8015831. + // Keeping behavior as-is and addressing the warning could cause a regression: + // https://github.com/flutter/packages/pull/10193 @SuppressWarnings("this-escape") public VideoPlayer( @NonNull VideoPlayerCallbacks events, diff --git a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureVideoPlayer.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureVideoPlayer.java index e482bdd85020..d623ddc88608 100644 --- a/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureVideoPlayer.java +++ b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/texture/TextureVideoPlayer.java @@ -30,6 +30,7 @@ public final class TextureVideoPlayer extends VideoPlayer implements SurfaceProducer.Callback { // True when the ExoPlayer instance has a null surface. private boolean needsSurface = true; + /** * Creates a texture video player. * @@ -89,7 +90,8 @@ protected ExoPlayerEventListener createExoPlayerEventListener( @NonNull ExoPlayer exoPlayer, @Nullable SurfaceProducer surfaceProducer) { if (surfaceProducer == null) { throw new IllegalArgumentException( - "surfaceProducer cannot be null to create an ExoPlayerEventListener for TextureVideoPlayer."); + "surfaceProducer cannot be null to create an ExoPlayerEventListener for" + + " TextureVideoPlayer."); } boolean surfaceProducerHandlesCropAndRotation = surfaceProducer.handlesCropAndRotation(); return new TextureExoPlayerEventListener( diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewProxyApi.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewProxyApi.java index af80d4b26423..e3016db2845d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewProxyApi.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewProxyApi.java @@ -58,7 +58,8 @@ public View getView() { @Override public void dispose() {} - // TODO(bparrishMines): This should be removed once https://github.com/flutter/engine/pull/40771 makes it to stable. + // TODO(bparrishMines): This should be removed once https://github.com/flutter/engine/pull/40771 + // makes it to stable. // Temporary fix for https://github.com/flutter/flutter/issues/92165. The FlutterView is setting // setImportantForAutofill(IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS) which prevents this // view from automatically being traversed for autofill. diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java index 3ca8ce924bb3..8ad8b29df915 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java @@ -309,7 +309,8 @@ public void defaultWebChromeClientIsSecureWebChromeClient() { webView.getWebChromeClient() instanceof WebChromeClientProxyApi.WebChromeClientImpl); } - // This test verifies that WebView.destroy() is called when the Dart instance is garbage collected. + // This test verifies that WebView.destroy() is called when the Dart instance is garbage + // collected. // This requires adding // // ``` diff --git a/script/tool/lib/src/format_command.dart b/script/tool/lib/src/format_command.dart index 87cc37cb411c..6da11fd2f810 100644 --- a/script/tool/lib/src/format_command.dart +++ b/script/tool/lib/src/format_command.dart @@ -39,9 +39,11 @@ const int _exitKotlinFormatFailed = 9; const int _exitSwiftLintFoundIssues = 10; const int _exitDartLanguageVersionIssue = 11; +// TODO(stuartmorgan): Update this once we require Java 21+. See +// https://github.com/google/google-java-format/releases/tag/v1.29.0. final Uri _javaFormatterUrl = Uri.https( 'github.com', - '/google/google-java-format/releases/download/google-java-format-1.3/google-java-format-1.3-all-deps.jar', + 'google/google-java-format/releases/download/v1.28.0/google-java-format-1.28.0-all-deps.jar', ); final Uri _kotlinFormatterUrl = Uri.https( 'maven.org', @@ -473,7 +475,7 @@ class FormatCommand extends PackageLoopingCommand { Future _getJavaFormatterPath() async { final String javaFormatterPath = path.join( path.dirname(path.fromUri(platform.script)), - 'google-java-format-1.3-all-deps.jar', + 'google-java-format-1.28.0-all-deps.jar', ); final File javaFormatterFile = packagesDir.fileSystem.file( javaFormatterPath, diff --git a/script/tool/test/format_command_test.dart b/script/tool/test/format_command_test.dart index c74140997e5b..aa7a7ccd6d2f 100644 --- a/script/tool/test/format_command_test.dart +++ b/script/tool/test/format_command_test.dart @@ -43,7 +43,7 @@ void main() { final p.Context path = analyzeCommand.path; javaFormatPath = path.join( path.dirname(path.fromUri(mockPlatform.script)), - 'google-java-format-1.3-all-deps.jar', + 'google-java-format-1.28.0-all-deps.jar', ); packagesDir.fileSystem.file(javaFormatPath).createSync(recursive: true); kotlinFormatPath = path.join( diff --git a/third_party/packages/mustache_template/.gitignore b/third_party/packages/mustache_template/.gitignore new file mode 100644 index 000000000000..263526e0a1d0 --- /dev/null +++ b/third_party/packages/mustache_template/.gitignore @@ -0,0 +1 @@ +test/spec diff --git a/third_party/packages/mustache_template/test/README.md b/third_party/packages/mustache_template/test/README.md new file mode 100644 index 000000000000..2ceca82a671d --- /dev/null +++ b/third_party/packages/mustache_template/test/README.md @@ -0,0 +1,23 @@ +# Test Structure + +## Specifications + +`mustache_test.dart` and `mustache_specs.dart` generate tests for all mustache specifications, +except for those disabled by `mustache_test.dart`'s `unsupportedSpecs` constant. +`dart test mustache_test.dart` runs all of the generated tests. + +Each generated specification file contains the mustache commit hash from which it was generated, +and the date when it was generated. + +### Updating specifications + +From the package root, run `dart run tool/download_spec.dart` to pull new definitions from the +mustache repository into `test/specs/`. + +## Features + +Standalone or handwritten tests regarding template output go in `feature_test.dart`. + +## Parser + +Tests for the template language parser go in `parser_test.dart`. diff --git a/third_party/packages/mustache_template/test/all.dart b/third_party/packages/mustache_template/test/all.dart deleted file mode 100644 index 0e7d0e4cbb20..000000000000 --- a/third_party/packages/mustache_template/test/all.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'mustache_specs.dart' as specs; -import 'mustache_test.dart' as test; -import 'parser_test.dart' as parser; - -void main() { - specs.main(); - test.main(); - parser.main(); -} diff --git a/third_party/packages/mustache_template/test/download-spec.sh b/third_party/packages/mustache_template/test/download-spec.sh deleted file mode 100755 index e36cb5bf9328..000000000000 --- a/third_party/packages/mustache_template/test/download-spec.sh +++ /dev/null @@ -1 +0,0 @@ -git clone https://github.com/mustache/spec.git diff --git a/third_party/packages/mustache_template/test/feature_test.dart b/third_party/packages/mustache_template/test/feature_test.dart new file mode 100644 index 000000000000..7f4ea4f079a2 --- /dev/null +++ b/third_party/packages/mustache_template/test/feature_test.dart @@ -0,0 +1,962 @@ +import 'package:mustache_template/mustache.dart'; +import 'package:test/test.dart'; + +const String UNEXPECTED_EOF = 'Unexpected end of input'; +const String BAD_VALUE_INV_SECTION = 'Invalid value type for inverse section'; +const String BAD_TAG_NAME = 'Unless in lenient mode, tags may only contain'; +const String VALUE_MISSING = 'Value was missing'; +const String UNCLOSED_TAG = 'Unclosed tag'; + +Template parse(String source, {bool lenient = false}) => + Template(source, lenient: lenient); + +void main() { + group('Basic', () { + test('Variable', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': 'bob'}); + expect(output, equals('_bob_')); + }); + test('Comment', () { + final String output = parse( + '_{{! i am a\n comment ! }}_', + ).renderString({}); + expect(output, equals('__')); + }); + test('Emoji', () { + final String output = parse( + 'Hello! 🖖👍🏽\nBye! 🏳️‍🌈', + ).renderString({}); + expect(output, equals('Hello! 🖖👍🏽\nBye! 🏳️‍🌈')); + }); + }); + group('Section', () { + test('Map', () { + final String output = parse('{{#section}}_{{var}}_{{/section}}') + .renderString(>{ + 'section': {'var': 'bob'}, + }); + expect(output, equals('_bob_')); + }); + test('List', () { + final String output = parse('{{#section}}_{{var}}_{{/section}}') + .renderString(>>{ + 'section': >[ + {'var': 'bob'}, + {'var': 'jim'}, + ], + }); + expect(output, equals('_bob__jim_')); + }); + test('Empty List', () { + final String output = parse( + '{{#section}}_{{var}}_{{/section}}', + ).renderString(>{'section': []}); + expect(output, equals('')); + }); + test('False', () { + final String output = parse( + '{{#section}}_{{var}}_{{/section}}', + ).renderString({'section': false}); + expect(output, equals('')); + }); + test('Invalid value', () { + final Exception? ex = renderFail( + '{{#section}}_{{var}}_{{/section}}', + {'section': 42}, + ); + if (ex is TemplateException) { + expect(ex.message, startsWith(VALUE_MISSING)); + } else { + fail('Unexpected type: $ex'); + } + }); + test('Invalid value - lenient mode', () { + final String output = parse( + '{{#var}}_{{var}}_{{/var}}', + lenient: true, + ).renderString({'var': 42}); + expect(output, equals('_42_')); + }); + + test('True', () { + final String output = parse( + '{{#section}}_ok_{{/section}}', + ).renderString({'section': true}); + expect(output, equals('_ok_')); + }); + + test('Nested', () { + final String output = + parse( + '{{#section}}.{{var}}.{{#nested}}_{{nestedvar}}_{{/nested}}.{{/section}}', + ).renderString(>{ + 'section': { + 'var': 'bob', + 'nested': >[ + {'nestedvar': 'jim'}, + {'nestedvar': 'sally'}, + ], + }, + }); + expect(output, equals('.bob._jim__sally_.')); + }); + + test('Whitespace in section tags', () { + expect( + parse('{{#foo.bar}}oi{{/foo.bar}}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + expect( + parse('{{# foo.bar}}oi{{/foo.bar}}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + expect( + parse('{{#foo.bar }}oi{{/foo.bar}}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + expect( + parse('{{# foo.bar }}oi{{/foo.bar}}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + expect( + parse('{{#foo.bar}}oi{{/ foo.bar}}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + expect( + parse('{{#foo.bar}}oi{{/foo.bar }}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + expect( + parse('{{#foo.bar}}oi{{/ foo.bar }}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + expect( + parse('{{# foo.bar }}oi{{/ foo.bar }}').renderString( + >{ + 'foo': {'bar': true}, + }, + ), + equals('oi'), + ); + }); + + test('Whitespace in variable tags', () { + expect( + parse('{{foo.bar}}').renderString(>{ + 'foo': {'bar': true}, + }), + equals('true'), + ); + expect( + parse('{{ foo.bar}}').renderString(>{ + 'foo': {'bar': true}, + }), + equals('true'), + ); + expect( + parse('{{foo.bar }}').renderString(>{ + 'foo': {'bar': true}, + }), + equals('true'), + ); + expect( + parse('{{ foo.bar }}').renderString(>{ + 'foo': {'bar': true}, + }), + equals('true'), + ); + }); + + test('Odd whitespace in tags', () { + void render(String source, dynamic values, dynamic output) => expect( + parse(source, lenient: true).renderString(values), + equals(output), + ); + + render('{{\t# foo}}oi{{\n/foo}}', {'foo': true}, 'oi'); + + render( + '{{ # # foo }} {{ oi }} {{ / # foo }}', + >>{ + '# foo': >[ + {'oi': 'OI!'}, + ], + }, + ' OI! ', + ); + + render( + '{{ #foo }} {{ oi }} {{ /foo }}', + >>{ + 'foo': >[ + {'oi': 'OI!'}, + ], + }, + ' OI! ', + ); + + render( + '{{\t#foo }} {{ oi }} {{ /foo }}', + >>{ + 'foo': >[ + {'oi': 'OI!'}, + ], + }, + ' OI! ', + ); + + render('{{{ #foo }}} {{{ /foo }}}', { + '#foo': 1, + '/foo': 2, + }, '1 2'); + + // Invalid - I'm ok with that for now. + // render( + // "{{{ { }}}", + // {'{': 1}, + // '1'); + + render('{{\nfoo}}', {'foo': 'bar'}, 'bar'); + + render('{{\tfoo}}', {'foo': 'bar'}, 'bar'); + + render('{{\t# foo}}oi{{\n/foo}}', {'foo': true}, 'oi'); + + render('{{{\tfoo\t}}}', {'foo': true}, 'true'); + }); + + test('Sigils in tag names in lenient mode', () { + void render(String source, dynamic values, dynamic output) => expect( + parse(source, lenient: true).renderString(values), + equals(output), + ); + + // Even in lenient mode, tag names may not be a single sigil + // character. + expect( + () => parse('{{#}}', lenient: true), + throwsA(isA()), + ); + expect( + () => parse('{{>}}', lenient: true), + throwsA(isA()), + ); + expect( + () => parse('{{&}}', lenient: true), + throwsA(isA()), + ); + expect( + () => parse('{{/}}', lenient: true), + throwsA(isA()), + ); + expect( + () => parse('{{^}}', lenient: true), + throwsA(isA()), + ); + + // >a means 'a partial named "a"', not a variable named ">a", + // and in lenient mode the missing partial should fail silently + // and yield an empty string. + render('{{ >a }}', {'>a': 'oi'}, ''); + + // sigils are valid in variable tag names as long as they aren't + // in the initial position. + render('{{ a> }}', {'a>': 'oi'}, 'oi'); + render('{{ a# }}', {'a#': 'oi'}, 'oi'); + }); + + test('Empty source', () { + final t = Template(''); + expect(t.renderString({}), equals('')); + }); + + test('Template name', () { + final t = Template('', name: 'foo'); + expect(t.name, equals('foo')); + }); + + test('Bad tag', () { + expect(() => Template('{{{ foo }|'), throwsException); + }); + }); + + group('Inverse Section', () { + test('Map', () { + final String output = parse('{{^section}}_{{var}}_{{/section}}') + .renderString(>{ + 'section': {'var': 'bob'}, + }); + expect(output, equals('')); + }); + test('List', () { + final String output = parse('{{^section}}_{{var}}_{{/section}}') + .renderString(>>{ + 'section': >[ + {'var': 'bob'}, + {'var': 'jim'}, + ], + }); + expect(output, equals('')); + }); + test('Empty List', () { + final String output = parse( + '{{^section}}_ok_{{/section}}', + ).renderString(>{'section': []}); + expect(output, equals('_ok_')); + }); + test('False', () { + final String output = parse( + '{{^section}}_ok_{{/section}}', + ).renderString({'section': false}); + expect(output, equals('_ok_')); + }); + test('Invalid value', () { + final Exception? ex = renderFail( + '{{^section}}_{{var}}_{{/section}}', + {'section': 42}, + ); + expect(ex is TemplateException, isTrue); + expect( + (ex! as TemplateException).message, + startsWith(BAD_VALUE_INV_SECTION), + ); + }); + test('Invalid value - lenient mode', () { + final String output = parse( + '{{^var}}_ok_{{/var}}', + lenient: true, + ).renderString({'var': 42}); + expect(output, equals('')); + }); + test('True', () { + final String output = parse( + '{{^section}}_ok_{{/section}}', + ).renderString({'section': true}); + expect(output, equals('')); + }); + }); + + group('Html escape', () { + test('Escape at start', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': '&.'}); + expect(output, equals('_&._')); + }); + + test('Escape at end', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': '.&'}); + expect(output, equals('_.&_')); + }); + + test('&', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': '&'}); + expect(output, equals('_&_')); + }); + + test('<', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': '<'}); + expect(output, equals('_<_')); + }); + + test('>', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': '>'}); + expect(output, equals('_>_')); + }); + + test('"', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': '"'}); + expect(output, equals('_"_')); + }); + + test("'", () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': "'"}); + expect(output, equals('_'_')); + }); + + test('/', () { + final String output = parse( + '_{{var}}_', + ).renderString({'var': '/'}); + expect(output, equals('_/_')); + }); + }); + + group('Invalid format', () { + test('Mismatched tag', () { + const source = '{{#section}}_{{var}}_{{/notsection}}'; + final Exception? ex = renderFail(source, >{ + 'section': {'var': 'bob'}, + }); + expectFail(ex, 1, 22, 'Mismatched tag'); + }); + + test('Unexpected EOF', () { + const source = '{{#section}}_{{var}}_{{/section'; + final Exception? ex = renderFail(source, >{ + 'section': {'var': 'bob'}, + }); + expectFail(ex, 1, 31, UNEXPECTED_EOF); + }); + + test('Bad tag name, open section', () { + const source = r'{{#section$%$^%}}_{{var}}_{{/section}}'; + final Exception? ex = renderFail(source, >{ + 'section': {'var': 'bob'}, + }); + expectFail(ex, null, null, BAD_TAG_NAME); + }); + + test('Bad tag name, close section', () { + const source = r'{{#section}}_{{var}}_{{/section$%$^%}}'; + final Exception? ex = renderFail(source, >{ + 'section': {'var': 'bob'}, + }); + expectFail(ex, null, null, BAD_TAG_NAME); + }); + + test('Bad tag name, variable', () { + const source = r'{{#section}}_{{var$%$^%}}_{{/section}}'; + final Exception? ex = renderFail(source, >{ + 'section': {'var': 'bob'}, + }); + expectFail(ex, null, null, BAD_TAG_NAME); + }); + + test('Missing variable', () { + const source = r'{{#section}}_{{var}}_{{/section}}'; + final Exception? ex = renderFail(source, >{ + 'section': {}, + }); + expectFail(ex, null, null, VALUE_MISSING); + }); + + // Null variables shouldn't be a problem. + test('Null variable', () { + final t = Template('{{#section}}_{{var}}_{{/section}}'); + final String output = t.renderString(>{ + 'section': {'var': null}, + }); + expect(output, equals('__')); + }); + + test('Unclosed section', () { + const source = r'{{#section}}foo'; + final Exception? ex = renderFail(source, >{ + 'section': {}, + }); + expectFail(ex, null, null, UNCLOSED_TAG); + }); + }); + + group('Lenient', () { + test('Odd section name', () { + final String output = + parse( + r'{{#section$%$^%}}_{{var}}_{{/section$%$^%}}', + lenient: true, + ).renderString(>{ + r'section$%$^%': {'var': 'bob'}, + }); + expect(output, equals('_bob_')); + }); + + test('Odd variable name', () { + final String output = + parse( + r'{{#section}}_{{var$%$^%}}_{{/section}}', + lenient: true, + ).renderString(>{ + 'section': {r'var$%$^%': 'bob'}, + }); + expect(output, equals('_bob_')); + }); + + test('Null variable', () { + final String output = + parse( + r'{{#section}}_{{var}}_{{/section}}', + lenient: true, + ).renderString(>{ + 'section': {'var': null}, + }); + expect(output, equals('__')); + }); + + test('Null section', () { + final String output = parse( + '{{#section}}_{{var}}_{{/section}}', + lenient: true, + ).renderString({'section': null}); + expect(output, equals('')); + }); + }); + + group('Escape tags', () { + test('{{{ ... }}}', () { + final String output = parse( + '{{{blah}}}', + ).renderString({'blah': '&'}); + expect(output, equals('&')); + }); + test('{{& ... }}', () { + final String output = parse( + '{{{blah}}}', + ).renderString({'blah': '&'}); + expect(output, equals('&')); + }); + }); + + group('Partial tag', () { + String partialTest( + Map values, + Map sources, + String renderTemplate, { + bool lenient = false, + }) { + final templates = {}; + Template? resolver(String name) => templates[name]; + for (final String k in sources.keys) { + templates[k] = Template( + sources[k]! as String, + name: k, + lenient: lenient, + partialResolver: resolver, + ); + } + final Template? t = resolver(renderTemplate); + return t!.renderString(values); + } + + test('basic', () { + final String output = partialTest( + {'foo': 'bar'}, + {'root': '{{>partial}}', 'partial': '{{foo}}'}, + 'root', + ); + expect(output, 'bar'); + }); + + test('missing partial strict', () { + var threw = false; + try { + partialTest( + {'foo': 'bar'}, + {'root': '{{>partial}}'}, + 'root', + ); + } on Exception catch (e) { + expect(e is TemplateException, isTrue); + threw = true; + } + expect(threw, isTrue); + }); + + test('missing partial lenient', () { + final String output = partialTest( + {'foo': 'bar'}, + {'root': '{{>partial}}'}, + 'root', + lenient: true, + ); + expect(output, equals('')); + }); + + test('context', () { + final String output = partialTest( + {'text': 'content'}, + {'root': '"{{>partial}}"', 'partial': '*{{text}}*'}, + 'root', + lenient: true, + ); + expect(output, equals('"*content*"')); + }); + + test('recursion', () { + final String output = partialTest( + { + 'content': 'X', + 'nodes': >[ + {'content': 'Y', 'nodes': []}, + ], + }, + { + 'root': '{{>node}}', + 'node': '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>', + }, + 'root', + lenient: true, + ); + expect(output, equals('X>')); + }); + + test('standalone without previous', () { + final String output = partialTest( + {}, + {'root': ' {{>partial}}\n>', 'partial': '>\n>'}, + 'root', + lenient: true, + ); + expect(output, equals(' >\n >>')); + }); + + test('standalone indentation', () { + final String output = partialTest( + {'content': '<\n->'}, + { + 'root': '\\\n {{>partial}}\n/\n', + 'partial': '|\n{{{content}}}\n|\n', + }, + 'root', + lenient: true, + ); + expect(output, equals('\\\n |\n <\n->\n |\n/\n')); + }); + }); + + group('Lambdas', () { + void lambdaTest({ + required String template, + dynamic lambda, + dynamic output, + }) => expect( + parse(template).renderString({'lambda': lambda}), + equals(output), + ); + + test('basic', () { + lambdaTest( + template: 'Hello, {{lambda}}!', + lambda: (_) => 'world', + output: 'Hello, world!', + ); + }); + + test('escaping', () { + lambdaTest( + template: '<{{lambda}}{{{lambda}}}', + lambda: (_) => '>', + output: '<>>', + ); + }); + + test('sections', () { + lambdaTest( + template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}', + lambda: (LambdaContext ctx) => '__${ctx.renderString()}__', + output: '__FILE__ != __LINE__', + ); + }); + + test('inverted sections truthy', () { + const template = '<{{^lambda}}{{static}}{{/lambda}}>'; + final values = { + 'lambda': (_) => false, + 'static': 'static', + }; + const output = '<>'; + expect(parse(template).renderString(values), equals(output)); + }); + + test("seth's use case", () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'markdown': (LambdaContext ctx) => ctx.renderString().toLowerCase(), + 'content': 'OI YOU!', + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('Lambda v2', () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'markdown': (LambdaContext ctx) => ctx.source, + 'content': 'OI YOU!', + }; + const output = '<{{content}}>'; + expect(parse(template).renderString(values), equals(output)); + }); + + test('Lambda v2...', () { + const template = '<{{#markdown}}dsfsf dsfsdf dfsdfsd{{/markdown}}>'; + final values = { + // ignore: avoid_dynamic_calls + 'markdown': (dynamic ctx) => ctx.source, + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('Alternate Delimiters', () { + // A lambda's return value should parse with the default delimiters. + + const template = '{{= | | =}}\nHello, (|&lambda|)!'; + + //function() { return "|planet| => {{planet}}" } + final values = { + 'planet': 'world', + 'lambda': (LambdaContext ctx) => + ctx.renderSource('|planet| => {{planet}}'), + }; + + const output = 'Hello, (|planet| => world)!'; + + expect(parse(template).renderString(values), equals(output)); + }); + + test('Alternate Delimiters 2', () { + // Lambdas used for sections should parse with the current delimiters. + + const template = '{{= | | =}}<|#lambda|-|/lambda|>'; + + //function() { return "|planet| => {{planet}}" } + final values = { + 'planet': 'Earth', + 'lambda': (LambdaContext ctx) { + final String txt = ctx.source; + return ctx.renderSource('$txt{{planet}} => |planet|$txt'); + }, + }; + + const output = '<-{{planet}} => Earth->'; + + expect(parse(template).renderString(values), equals(output)); + }); + + test('LambdaContext.lookup', () { + final t = Template('{{ foo }}'); + final String s = t.renderString({ + 'foo': (LambdaContext lc) => lc.lookup('bar'), + 'bar': 'jim', + }); + expect(s, equals('jim')); + }); + + test('LambdaContext.lookup closed', () { + final t = Template('{{ foo }}'); + LambdaContext? lc2; + t.renderString({ + 'foo': (LambdaContext lc) => lc2 = lc, + 'bar': 'jim', + }); + expect(lc2, isNotNull); + expect(() => lc2?.lookup('foo'), throwsException); + }); + }); + + group('Other', () { + test('Standalone line', () { + final String val = parse( + '|\n{{#bob}}\n{{/bob}}\n|', + ).renderString(>{'bob': []}); + expect(val, equals('|\n|')); + }); + }); + + group('Array indexing', () { + test('Basic', () { + final String val = parse('{{array.1}}').renderString(>{ + 'array': [1, 2, 3], + }); + expect(val, equals('2')); + }); + test('RangeError', () { + final Exception? error = renderFail('{{array.5}}', >{ + 'array': [1, 2, 3], + }); + expect(error, isA()); + }); + }); + + group('Delimiters', () { + test('Basic', () { + final String val = parse( + '{{=<% %>=}}(<%text%>)', + ).renderString({'text': 'Hey!'}); + expect(val, equals('(Hey!)')); + }); + + test('Single delimiters', () { + final String val = parse( + '({{=[ ]=}}[text])', + ).renderString({'text': 'It worked!'}); + expect(val, equals('(It worked!)')); + }); + }); + + group('Template with custom delimiters', () { + test('Basic', () { + final t = Template('(<%text%>)', delimiters: '<% %>'); + final String val = t.renderString({'text': 'Hey!'}); + expect(val, equals('(Hey!)')); + }); + }); + + group('Lambda context', () { + test('LambdaContext write', () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'markdown': (LambdaContext ctx) { + ctx.write('foo'); + }, + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('LambdaContext render', () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'content': 'bar', + 'markdown': (LambdaContext ctx) { + ctx.render(); + }, + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('LambdaContext render with value', () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'markdown': (LambdaContext ctx) { + ctx.render(value: {'content': 'oi!'}); + }, + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('LambdaContext renderString with value', () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'markdown': (LambdaContext ctx) { + return ctx.renderString(value: {'content': 'oi!'}); + }, + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('LambdaContext write and return', () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'markdown': (LambdaContext ctx) { + ctx.write('foo'); + return 'bar'; + }, + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('LambdaContext renderSource with value', () { + const template = '<{{#markdown}}{{content}}{{/markdown}}>'; + final values = { + 'markdown': (LambdaContext ctx) { + return ctx.renderSource( + ctx.source, + value: {'content': 'oi!'}, + ); + }, + }; + const output = ''; + expect(parse(template).renderString(values), equals(output)); + }); + + test('LambdaContext renderString on non-section throws', () { + final t = Template('{{ foo }}'); + expect( + () => t.renderString({ + 'foo': (LambdaContext lc) => lc.renderString(), + }), + throwsA(isA()), + ); + }); + + test('LambdaContext render on non-section throws', () { + final t = Template('{{ foo }}'); + expect( + () => t.renderString({ + 'foo': (LambdaContext lc) { + lc.render(); + return ''; + }, + }), + throwsA(isA()), + ); + }); + }); +} + +Exception? renderFail(String source, Object values) { + try { + parse(source).renderString(values); + return null; + } on Exception catch (e) { + return e; + } +} + +void expectFail( + Exception? ex, + int? line, + int? column, [ + String? msgStartsWith, +]) { + if (ex is! TemplateException) { + fail('Unexpected type: $ex'); + } + if (line != null) { + expect(ex.line, equals(line)); + } + if (column != null) { + expect(ex.column, equals(column)); + } + if (msgStartsWith != null) { + expect(ex.message, startsWith(msgStartsWith)); + } +} diff --git a/third_party/packages/mustache_template/test/mustache_specs.dart b/third_party/packages/mustache_template/test/mustache_specs.dart index d0a565fcd728..5063e8513cb7 100644 --- a/third_party/packages/mustache_template/test/mustache_specs.dart +++ b/third_party/packages/mustache_template/test/mustache_specs.dart @@ -4,11 +4,12 @@ // See: https://github.com/valotas/mustache4dart import 'dart:convert'; -import 'dart:io'; import 'package:mustache_template/mustache.dart'; import 'package:test/test.dart'; +import 'specs/specs.dart'; + String render( String source, dynamic values, { @@ -26,21 +27,12 @@ String render( return t.renderString(values); } -void main() { - defineTests(); -} - -void defineTests() { - final specsDir = Directory('test/spec/specs'); - specsDir.listSync().forEach((FileSystemEntity f) { - if (f is File) { - final String filename = f.path; - if (shouldRun(filename)) { - final String text = f.readAsStringSync(); - _defineGroupFromFile(filename, text); - } +void defineTests(List unsupportedSpecs) { + for (final MapEntry(key: specName, value: text) in SPECS.entries) { + if (shouldRun(specName, unsupportedSpecs)) { + _defineGroupFromFile(specName, text); } - }); + } } void _defineGroupFromFile(String filename, String text) { @@ -91,12 +83,8 @@ void _defineGroupFromFile(String filename, String text) { }); } -bool shouldRun(String filename) { - // filter out only .json files - if (!filename.endsWith('.json')) { - return false; - } - return true; +bool shouldRun(String specName, List unsupportedSpecs) { + return !unsupportedSpecs.contains(specName); } String Function(Object?) _dummyCallableWithState() { diff --git a/third_party/packages/mustache_template/test/mustache_test.dart b/third_party/packages/mustache_template/test/mustache_test.dart index a8149220ba76..fb2ddf237372 100644 --- a/third_party/packages/mustache_template/test/mustache_test.dart +++ b/third_party/packages/mustache_template/test/mustache_test.dart @@ -1,939 +1,9 @@ -import 'package:mustache_template/mustache.dart'; -import 'package:test/test.dart'; +import 'mustache_specs.dart' as specs; -const String UNEXPECTED_EOF = 'Unexpected end of input'; -const String BAD_VALUE_INV_SECTION = 'Invalid value type for inverse section'; -const String BAD_TAG_NAME = 'Unless in lenient mode, tags may only contain'; -const String VALUE_MISSING = 'Value was missing'; -const String UNCLOSED_TAG = 'Unclosed tag'; - -Template parse(String source, {bool lenient = false}) => - Template(source, lenient: lenient); +/// Optional specifications that are not currently supported +/// by this library, in the format of the keys in the SPECS map in specs/specs.dart +const List unsupportedSpecs = ['inheritance', 'dynamic_names']; void main() { - group('Basic', () { - test('Variable', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': 'bob'}); - expect(output, equals('_bob_')); - }); - test('Comment', () { - final String output = parse( - '_{{! i am a\n comment ! }}_', - ).renderString({}); - expect(output, equals('__')); - }); - test('Emoji', () { - final String output = parse( - 'Hello! 🖖👍🏽\nBye! 🏳️‍🌈', - ).renderString({}); - expect(output, equals('Hello! 🖖👍🏽\nBye! 🏳️‍🌈')); - }); - }); - group('Section', () { - test('Map', () { - final String output = parse('{{#section}}_{{var}}_{{/section}}') - .renderString(>{ - 'section': {'var': 'bob'}, - }); - expect(output, equals('_bob_')); - }); - test('List', () { - final String output = parse('{{#section}}_{{var}}_{{/section}}') - .renderString(>>{ - 'section': >[ - {'var': 'bob'}, - {'var': 'jim'}, - ], - }); - expect(output, equals('_bob__jim_')); - }); - test('Empty List', () { - final String output = parse( - '{{#section}}_{{var}}_{{/section}}', - ).renderString(>{'section': []}); - expect(output, equals('')); - }); - test('False', () { - final String output = parse( - '{{#section}}_{{var}}_{{/section}}', - ).renderString({'section': false}); - expect(output, equals('')); - }); - test('Invalid value', () { - final Exception? ex = renderFail( - '{{#section}}_{{var}}_{{/section}}', - {'section': 42}, - ); - if (ex is TemplateException) { - expect(ex.message, startsWith(VALUE_MISSING)); - } else { - fail('Unexpected type: $ex'); - } - }); - test('Invalid value - lenient mode', () { - final String output = parse( - '{{#var}}_{{var}}_{{/var}}', - lenient: true, - ).renderString({'var': 42}); - expect(output, equals('_42_')); - }); - - test('True', () { - final String output = parse( - '{{#section}}_ok_{{/section}}', - ).renderString({'section': true}); - expect(output, equals('_ok_')); - }); - - test('Nested', () { - final String output = - parse( - '{{#section}}.{{var}}.{{#nested}}_{{nestedvar}}_{{/nested}}.{{/section}}', - ).renderString(>{ - 'section': { - 'var': 'bob', - 'nested': >[ - {'nestedvar': 'jim'}, - {'nestedvar': 'sally'}, - ], - }, - }); - expect(output, equals('.bob._jim__sally_.')); - }); - - test('Whitespace in section tags', () { - expect( - parse('{{#foo.bar}}oi{{/foo.bar}}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - expect( - parse('{{# foo.bar}}oi{{/foo.bar}}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - expect( - parse('{{#foo.bar }}oi{{/foo.bar}}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - expect( - parse('{{# foo.bar }}oi{{/foo.bar}}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - expect( - parse('{{#foo.bar}}oi{{/ foo.bar}}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - expect( - parse('{{#foo.bar}}oi{{/foo.bar }}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - expect( - parse('{{#foo.bar}}oi{{/ foo.bar }}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - expect( - parse('{{# foo.bar }}oi{{/ foo.bar }}').renderString( - >{ - 'foo': {'bar': true}, - }, - ), - equals('oi'), - ); - }); - - test('Whitespace in variable tags', () { - expect( - parse('{{foo.bar}}').renderString(>{ - 'foo': {'bar': true}, - }), - equals('true'), - ); - expect( - parse('{{ foo.bar}}').renderString(>{ - 'foo': {'bar': true}, - }), - equals('true'), - ); - expect( - parse('{{foo.bar }}').renderString(>{ - 'foo': {'bar': true}, - }), - equals('true'), - ); - expect( - parse('{{ foo.bar }}').renderString(>{ - 'foo': {'bar': true}, - }), - equals('true'), - ); - }); - - test('Odd whitespace in tags', () { - void render(String source, dynamic values, dynamic output) => expect( - parse(source, lenient: true).renderString(values), - equals(output), - ); - - render('{{\t# foo}}oi{{\n/foo}}', {'foo': true}, 'oi'); - - render( - '{{ # # foo }} {{ oi }} {{ / # foo }}', - >>{ - '# foo': >[ - {'oi': 'OI!'}, - ], - }, - ' OI! ', - ); - - render( - '{{ #foo }} {{ oi }} {{ /foo }}', - >>{ - 'foo': >[ - {'oi': 'OI!'}, - ], - }, - ' OI! ', - ); - - render( - '{{\t#foo }} {{ oi }} {{ /foo }}', - >>{ - 'foo': >[ - {'oi': 'OI!'}, - ], - }, - ' OI! ', - ); - - render('{{{ #foo }}} {{{ /foo }}}', { - '#foo': 1, - '/foo': 2, - }, '1 2'); - - // Invalid - I'm ok with that for now. - // render( - // "{{{ { }}}", - // {'{': 1}, - // '1'); - - render('{{\nfoo}}', {'foo': 'bar'}, 'bar'); - - render('{{\tfoo}}', {'foo': 'bar'}, 'bar'); - - render('{{\t# foo}}oi{{\n/foo}}', {'foo': true}, 'oi'); - - render('{{{\tfoo\t}}}', {'foo': true}, 'true'); - - // TODO(stuartmorgan): Fix and enable this test, which was commented out - // when the source was first imported. - // empty, or error in strict mode. - // render( - // "{{ > }}", - // {'>': 'oi'}, - // ''); - }); - - test('Empty source', () { - final t = Template(''); - expect(t.renderString({}), equals('')); - }); - - test('Template name', () { - final t = Template('', name: 'foo'); - expect(t.name, equals('foo')); - }); - - test('Bad tag', () { - expect(() => Template('{{{ foo }|'), throwsException); - }); - }); - - group('Inverse Section', () { - test('Map', () { - final String output = parse('{{^section}}_{{var}}_{{/section}}') - .renderString(>{ - 'section': {'var': 'bob'}, - }); - expect(output, equals('')); - }); - test('List', () { - final String output = parse('{{^section}}_{{var}}_{{/section}}') - .renderString(>>{ - 'section': >[ - {'var': 'bob'}, - {'var': 'jim'}, - ], - }); - expect(output, equals('')); - }); - test('Empty List', () { - final String output = parse( - '{{^section}}_ok_{{/section}}', - ).renderString(>{'section': []}); - expect(output, equals('_ok_')); - }); - test('False', () { - final String output = parse( - '{{^section}}_ok_{{/section}}', - ).renderString({'section': false}); - expect(output, equals('_ok_')); - }); - test('Invalid value', () { - final Exception? ex = renderFail( - '{{^section}}_{{var}}_{{/section}}', - {'section': 42}, - ); - expect(ex is TemplateException, isTrue); - expect( - (ex! as TemplateException).message, - startsWith(BAD_VALUE_INV_SECTION), - ); - }); - test('Invalid value - lenient mode', () { - final String output = parse( - '{{^var}}_ok_{{/var}}', - lenient: true, - ).renderString({'var': 42}); - expect(output, equals('')); - }); - test('True', () { - final String output = parse( - '{{^section}}_ok_{{/section}}', - ).renderString({'section': true}); - expect(output, equals('')); - }); - }); - - group('Html escape', () { - test('Escape at start', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': '&.'}); - expect(output, equals('_&._')); - }); - - test('Escape at end', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': '.&'}); - expect(output, equals('_.&_')); - }); - - test('&', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': '&'}); - expect(output, equals('_&_')); - }); - - test('<', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': '<'}); - expect(output, equals('_<_')); - }); - - test('>', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': '>'}); - expect(output, equals('_>_')); - }); - - test('"', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': '"'}); - expect(output, equals('_"_')); - }); - - test("'", () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': "'"}); - expect(output, equals('_'_')); - }); - - test('/', () { - final String output = parse( - '_{{var}}_', - ).renderString({'var': '/'}); - expect(output, equals('_/_')); - }); - }); - - group('Invalid format', () { - test('Mismatched tag', () { - const source = '{{#section}}_{{var}}_{{/notsection}}'; - final Exception? ex = renderFail(source, >{ - 'section': {'var': 'bob'}, - }); - expectFail(ex, 1, 22, 'Mismatched tag'); - }); - - test('Unexpected EOF', () { - const source = '{{#section}}_{{var}}_{{/section'; - final Exception? ex = renderFail(source, >{ - 'section': {'var': 'bob'}, - }); - expectFail(ex, 1, 31, UNEXPECTED_EOF); - }); - - test('Bad tag name, open section', () { - const source = r'{{#section$%$^%}}_{{var}}_{{/section}}'; - final Exception? ex = renderFail(source, >{ - 'section': {'var': 'bob'}, - }); - expectFail(ex, null, null, BAD_TAG_NAME); - }); - - test('Bad tag name, close section', () { - const source = r'{{#section}}_{{var}}_{{/section$%$^%}}'; - final Exception? ex = renderFail(source, >{ - 'section': {'var': 'bob'}, - }); - expectFail(ex, null, null, BAD_TAG_NAME); - }); - - test('Bad tag name, variable', () { - const source = r'{{#section}}_{{var$%$^%}}_{{/section}}'; - final Exception? ex = renderFail(source, >{ - 'section': {'var': 'bob'}, - }); - expectFail(ex, null, null, BAD_TAG_NAME); - }); - - test('Missing variable', () { - const source = r'{{#section}}_{{var}}_{{/section}}'; - final Exception? ex = renderFail(source, >{ - 'section': {}, - }); - expectFail(ex, null, null, VALUE_MISSING); - }); - - // Null variables shouldn't be a problem. - test('Null variable', () { - final t = Template('{{#section}}_{{var}}_{{/section}}'); - final String output = t.renderString(>{ - 'section': {'var': null}, - }); - expect(output, equals('__')); - }); - - test('Unclosed section', () { - const source = r'{{#section}}foo'; - final Exception? ex = renderFail(source, >{ - 'section': {}, - }); - expectFail(ex, null, null, UNCLOSED_TAG); - }); - }); - - group('Lenient', () { - test('Odd section name', () { - final String output = - parse( - r'{{#section$%$^%}}_{{var}}_{{/section$%$^%}}', - lenient: true, - ).renderString(>{ - r'section$%$^%': {'var': 'bob'}, - }); - expect(output, equals('_bob_')); - }); - - test('Odd variable name', () { - final String output = - parse( - r'{{#section}}_{{var$%$^%}}_{{/section}}', - lenient: true, - ).renderString(>{ - 'section': {r'var$%$^%': 'bob'}, - }); - expect(output, equals('_bob_')); - }); - - test('Null variable', () { - final String output = - parse( - r'{{#section}}_{{var}}_{{/section}}', - lenient: true, - ).renderString(>{ - 'section': {'var': null}, - }); - expect(output, equals('__')); - }); - - test('Null section', () { - final String output = parse( - '{{#section}}_{{var}}_{{/section}}', - lenient: true, - ).renderString({'section': null}); - expect(output, equals('')); - }); - - // Known failure - // test('Null inverse section', () { - // var output = parse('{{^section}}_{{var}}_{{/section}}', lenient: true) - // .renderString({"section": null}, lenient: true); - // expect(output, equals('')); - // }); - }); - - group('Escape tags', () { - test('{{{ ... }}}', () { - final String output = parse( - '{{{blah}}}', - ).renderString({'blah': '&'}); - expect(output, equals('&')); - }); - test('{{& ... }}', () { - final String output = parse( - '{{{blah}}}', - ).renderString({'blah': '&'}); - expect(output, equals('&')); - }); - }); - - group('Partial tag', () { - String partialTest( - Map values, - Map sources, - String renderTemplate, { - bool lenient = false, - }) { - final templates = {}; - Template? resolver(String name) => templates[name]; - for (final String k in sources.keys) { - templates[k] = Template( - sources[k]! as String, - name: k, - lenient: lenient, - partialResolver: resolver, - ); - } - final Template? t = resolver(renderTemplate); - return t!.renderString(values); - } - - test('basic', () { - final String output = partialTest( - {'foo': 'bar'}, - {'root': '{{>partial}}', 'partial': '{{foo}}'}, - 'root', - ); - expect(output, 'bar'); - }); - - test('missing partial strict', () { - var threw = false; - try { - partialTest( - {'foo': 'bar'}, - {'root': '{{>partial}}'}, - 'root', - ); - } on Exception catch (e) { - expect(e is TemplateException, isTrue); - threw = true; - } - expect(threw, isTrue); - }); - - test('missing partial lenient', () { - final String output = partialTest( - {'foo': 'bar'}, - {'root': '{{>partial}}'}, - 'root', - lenient: true, - ); - expect(output, equals('')); - }); - - test('context', () { - final String output = partialTest( - {'text': 'content'}, - {'root': '"{{>partial}}"', 'partial': '*{{text}}*'}, - 'root', - lenient: true, - ); - expect(output, equals('"*content*"')); - }); - - test('recursion', () { - final String output = partialTest( - { - 'content': 'X', - 'nodes': >[ - {'content': 'Y', 'nodes': []}, - ], - }, - { - 'root': '{{>node}}', - 'node': '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>', - }, - 'root', - lenient: true, - ); - expect(output, equals('X>')); - }); - - test('standalone without previous', () { - final String output = partialTest( - {}, - {'root': ' {{>partial}}\n>', 'partial': '>\n>'}, - 'root', - lenient: true, - ); - expect(output, equals(' >\n >>')); - }); - - test('standalone indentation', () { - final String output = partialTest( - {'content': '<\n->'}, - { - 'root': '\\\n {{>partial}}\n/\n', - 'partial': '|\n{{{content}}}\n|\n', - }, - 'root', - lenient: true, - ); - expect(output, equals('\\\n |\n <\n->\n |\n/\n')); - }); - }); - - group('Lambdas', () { - void lambdaTest({ - required String template, - dynamic lambda, - dynamic output, - }) => expect( - parse(template).renderString({'lambda': lambda}), - equals(output), - ); - - test('basic', () { - lambdaTest( - template: 'Hello, {{lambda}}!', - lambda: (_) => 'world', - output: 'Hello, world!', - ); - }); - - test('escaping', () { - lambdaTest( - template: '<{{lambda}}{{{lambda}}}', - lambda: (_) => '>', - output: '<>>', - ); - }); - - test('sections', () { - lambdaTest( - template: '{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}', - lambda: (LambdaContext ctx) => '__${ctx.renderString()}__', - output: '__FILE__ != __LINE__', - ); - }); - - // TODO(stuartmorgan): Fix and re-enable this test, which was skipped when - // the package was first imported. - test('inverted sections truthy', () { - const template = '<{{^lambda}}{{static}}{{/lambda}}>'; - final values = { - 'lambda': (_) => false, - 'static': 'static', - }; - const output = '<>'; - expect(parse(template).renderString(values), equals(output)); - }, skip: 'skip test'); - - test("seth's use case", () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'markdown': (LambdaContext ctx) => ctx.renderString().toLowerCase(), - 'content': 'OI YOU!', - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('Lambda v2', () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'markdown': (LambdaContext ctx) => ctx.source, - 'content': 'OI YOU!', - }; - const output = '<{{content}}>'; - expect(parse(template).renderString(values), equals(output)); - }); - - test('Lambda v2...', () { - const template = '<{{#markdown}}dsfsf dsfsdf dfsdfsd{{/markdown}}>'; - final values = { - // ignore: avoid_dynamic_calls - 'markdown': (dynamic ctx) => ctx.source, - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('Alternate Delimiters', () { - // A lambda's return value should parse with the default delimiters. - - const template = '{{= | | =}}\nHello, (|&lambda|)!'; - - //function() { return "|planet| => {{planet}}" } - final values = { - 'planet': 'world', - 'lambda': (LambdaContext ctx) => - ctx.renderSource('|planet| => {{planet}}'), - }; - - const output = 'Hello, (|planet| => world)!'; - - expect(parse(template).renderString(values), equals(output)); - }); - - test('Alternate Delimiters 2', () { - // Lambdas used for sections should parse with the current delimiters. - - const template = '{{= | | =}}<|#lambda|-|/lambda|>'; - - //function() { return "|planet| => {{planet}}" } - final values = { - 'planet': 'Earth', - 'lambda': (LambdaContext ctx) { - final String txt = ctx.source; - return ctx.renderSource('$txt{{planet}} => |planet|$txt'); - }, - }; - - const output = '<-{{planet}} => Earth->'; - - expect(parse(template).renderString(values), equals(output)); - }); - - test('LambdaContext.lookup', () { - final t = Template('{{ foo }}'); - final String s = t.renderString({ - 'foo': (LambdaContext lc) => lc.lookup('bar'), - 'bar': 'jim', - }); - expect(s, equals('jim')); - }); - - test('LambdaContext.lookup closed', () { - final t = Template('{{ foo }}'); - LambdaContext? lc2; - t.renderString({ - 'foo': (LambdaContext lc) => lc2 = lc, - 'bar': 'jim', - }); - expect(lc2, isNotNull); - expect(() => lc2?.lookup('foo'), throwsException); - }); - }); - - group('Other', () { - test('Standalone line', () { - final String val = parse( - '|\n{{#bob}}\n{{/bob}}\n|', - ).renderString(>{'bob': []}); - expect(val, equals('|\n|')); - }); - }); - - group('Array indexing', () { - test('Basic', () { - final String val = parse('{{array.1}}').renderString(>{ - 'array': [1, 2, 3], - }); - expect(val, equals('2')); - }); - test('RangeError', () { - final Exception? error = renderFail('{{array.5}}', >{ - 'array': [1, 2, 3], - }); - expect(error, isA()); - }); - }); - - group('Delimiters', () { - test('Basic', () { - final String val = parse( - '{{=<% %>=}}(<%text%>)', - ).renderString({'text': 'Hey!'}); - expect(val, equals('(Hey!)')); - }); - - test('Single delimiters', () { - final String val = parse( - '({{=[ ]=}}[text])', - ).renderString({'text': 'It worked!'}); - expect(val, equals('(It worked!)')); - }); - }); - - group('Template with custom delimiters', () { - test('Basic', () { - final t = Template('(<%text%>)', delimiters: '<% %>'); - final String val = t.renderString({'text': 'Hey!'}); - expect(val, equals('(Hey!)')); - }); - }); - - group('Lambda context', () { - test('LambdaContext write', () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'markdown': (LambdaContext ctx) { - ctx.write('foo'); - }, - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('LambdaContext render', () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'content': 'bar', - 'markdown': (LambdaContext ctx) { - ctx.render(); - }, - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('LambdaContext render with value', () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'markdown': (LambdaContext ctx) { - ctx.render(value: {'content': 'oi!'}); - }, - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('LambdaContext renderString with value', () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'markdown': (LambdaContext ctx) { - return ctx.renderString(value: {'content': 'oi!'}); - }, - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('LambdaContext write and return', () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'markdown': (LambdaContext ctx) { - ctx.write('foo'); - return 'bar'; - }, - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('LambdaContext renderSource with value', () { - const template = '<{{#markdown}}{{content}}{{/markdown}}>'; - final values = { - 'markdown': (LambdaContext ctx) { - return ctx.renderSource( - ctx.source, - value: {'content': 'oi!'}, - ); - }, - }; - const output = ''; - expect(parse(template).renderString(values), equals(output)); - }); - - test('LambdaContext renderString on non-section throws', () { - final t = Template('{{ foo }}'); - expect( - () => t.renderString({ - 'foo': (LambdaContext lc) => lc.renderString(), - }), - throwsA(isA()), - ); - }); - - test('LambdaContext render on non-section throws', () { - final t = Template('{{ foo }}'); - expect( - () => t.renderString({ - 'foo': (LambdaContext lc) { - lc.render(); - return ''; - }, - }), - throwsA(isA()), - ); - }); - }); -} - -Exception? renderFail(String source, Object values) { - try { - parse(source).renderString(values); - return null; - } on Exception catch (e) { - return e; - } -} - -void expectFail( - Exception? ex, - int? line, - int? column, [ - String? msgStartsWith, -]) { - if (ex is! TemplateException) { - fail('Unexpected type: $ex'); - } - if (line != null) { - expect(ex.line, equals(line)); - } - if (column != null) { - expect(ex.column, equals(column)); - } - if (msgStartsWith != null) { - expect(ex.message, startsWith(msgStartsWith)); - } + specs.defineTests(unsupportedSpecs); } diff --git a/third_party/packages/mustache_template/test/parser_test.dart b/third_party/packages/mustache_template/test/parser_test.dart index c3f8427e4978..1c095bc44927 100644 --- a/third_party/packages/mustache_template/test/parser_test.dart +++ b/third_party/packages/mustache_template/test/parser_test.dart @@ -281,14 +281,7 @@ void main() { test('corner case strict', () { const source = '{{{ #foo }}} {{{ /foo }}}'; final parser = Parser(source, 'foo', '{{ }}'); - try { - parser.parse(); - // TODO(stuartmorgan): Restructure test to use throwsA. - // ignore: use_test_throws_matchers - fail('Should fail.'); - } on Exception catch (e) { - expect(e is TemplateException, isTrue); - } + expect(() => parser.parse(), throwsA(isA())); }); test('corner case lenient', () { @@ -327,25 +320,16 @@ void main() { ex.toString(); }); - Exception parseFail(String source) { - try { + void Function() parseFail(String source) { + return () { final parser = Parser(source, 'foo', '{{ }}'); parser.parse(); - // TODO(stuartmorgan): Restructure test to use throwsA. - // ignore: use_test_throws_matchers - fail('Did not throw.'); - } on Exception catch (ex, st) { - if (ex is! TemplateException) { - print(ex); - print(st); - } - return ex; - } + }; } test('parse eof', () { - void expectTemplateEx(Exception ex) => - expect(ex is TemplateException, isTrue); + void expectTemplateEx(void Function() shouldThrow) => + expect(shouldThrow, throwsA(isA())); expectTemplateEx(parseFail('{{#foo}}{{bar}}{{/foo}')); expectTemplateEx(parseFail('{{#foo}}{{bar}}{{/foo')); diff --git a/third_party/packages/mustache_template/test/specs/comments.dart b/third_party/packages/mustache_template/test/specs/comments.dart new file mode 100644 index 000000000000..9dd41f6a33ef --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/comments.dart @@ -0,0 +1,109 @@ +// Generated from comments.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String COMMENTS = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Comment tags represent content that should never appear in the resulting\noutput.\n\nThe tag's content may contain any substring (including newlines) EXCEPT the\nclosing delimiter.\n\nComment tags SHOULD be treated as standalone when appropriate.\n", + "tests": [ + { + "name": "Inline", + "desc": "Comment blocks should be removed from the template.", + "data": { + }, + "template": "12345{{! Comment Block! }}67890", + "expected": "1234567890" + }, + { + "name": "Multiline", + "desc": "Multiline comments should be permitted.", + "data": { + }, + "template": "12345{{!\n This is a\n multi-line comment...\n}}67890\n", + "expected": "1234567890\n" + }, + { + "name": "Standalone", + "desc": "All standalone comment lines should be removed.", + "data": { + }, + "template": "Begin.\n{{! Comment Block! }}\nEnd.\n", + "expected": "Begin.\nEnd.\n" + }, + { + "name": "Indented Standalone", + "desc": "All standalone comment lines should be removed.", + "data": { + }, + "template": "Begin.\n {{! Indented Comment Block! }}\nEnd.\n", + "expected": "Begin.\nEnd.\n" + }, + { + "name": "Standalone Line Endings", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags.", + "data": { + }, + "template": "|\r\n{{! Standalone Comment }}\r\n|", + "expected": "|\r\n|" + }, + { + "name": "Standalone Without Previous Line", + "desc": "Standalone tags should not require a newline to precede them.", + "data": { + }, + "template": " {{! I'm Still Standalone }}\n!", + "expected": "!" + }, + { + "name": "Standalone Without Newline", + "desc": "Standalone tags should not require a newline to follow them.", + "data": { + }, + "template": "!\n {{! I'm Still Standalone }}", + "expected": "!\n" + }, + { + "name": "Multiline Standalone", + "desc": "All standalone comment lines should be removed.", + "data": { + }, + "template": "Begin.\n{{!\nSomething's going on here...\n}}\nEnd.\n", + "expected": "Begin.\nEnd.\n" + }, + { + "name": "Indented Multiline Standalone", + "desc": "All standalone comment lines should be removed.", + "data": { + }, + "template": "Begin.\n {{!\n Something's going on here...\n }}\nEnd.\n", + "expected": "Begin.\nEnd.\n" + }, + { + "name": "Indented Inline", + "desc": "Inline comments should not strip whitespace", + "data": { + }, + "template": " 12 {{! 34 }}\n", + "expected": " 12 \n" + }, + { + "name": "Surrounding Whitespace", + "desc": "Comment removal should preserve surrounding whitespace.", + "data": { + }, + "template": "12345 {{! Comment Block! }} 67890", + "expected": "12345 67890" + }, + { + "name": "Variable Name Collision", + "desc": "Comments must never render, even if variable with same name exists.", + "data": { + "! comment": 1, + "! comment ": 2, + "!comment": 3, + "comment": 4 + }, + "template": "comments never show: >{{! comment }}<", + "expected": "comments never show: ><" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/delimiters.dart b/third_party/packages/mustache_template/test/specs/delimiters.dart new file mode 100644 index 000000000000..fe776e9126b8 --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/delimiters.dart @@ -0,0 +1,135 @@ +// Generated from delimiters.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String DELIMITERS = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Set Delimiter tags are used to change the tag delimiters for all content\nfollowing the tag in the current compilation unit.\n\nThe tag's content MUST be any two non-whitespace sequences (separated by\nwhitespace) EXCEPT an equals sign ('=') followed by the current closing\ndelimiter.\n\nSet Delimiter tags SHOULD be treated as standalone when appropriate.\n", + "tests": [ + { + "name": "Pair Behavior", + "desc": "The equals sign (used on both sides) should permit delimiter changes.", + "data": { + "text": "Hey!" + }, + "template": "{{=<% %>=}}(<%text%>)", + "expected": "(Hey!)" + }, + { + "name": "Special Characters", + "desc": "Characters with special meaning regexen should be valid delimiters.", + "data": { + "text": "It worked!" + }, + "template": "({{=[ ]=}}[text])", + "expected": "(It worked!)" + }, + { + "name": "Sections", + "desc": "Delimiters set outside sections should persist.", + "data": { + "section": true, + "data": "I got interpolated." + }, + "template": "[\n{{#section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|#section|\n {{data}}\n |data|\n|/section|\n]\n", + "expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n" + }, + { + "name": "Inverted Sections", + "desc": "Delimiters set outside inverted sections should persist.", + "data": { + "section": false, + "data": "I got interpolated." + }, + "template": "[\n{{^section}}\n {{data}}\n |data|\n{{/section}}\n\n{{= | | =}}\n|^section|\n {{data}}\n |data|\n|/section|\n]\n", + "expected": "[\n I got interpolated.\n |data|\n\n {{data}}\n I got interpolated.\n]\n" + }, + { + "name": "Partial Inheritence", + "desc": "Delimiters set in a parent template should not affect a partial.", + "data": { + "value": "yes" + }, + "partials": { + "include": ".{{value}}." + }, + "template": "[ {{>include}} ]\n{{= | | =}}\n[ |>include| ]\n", + "expected": "[ .yes. ]\n[ .yes. ]\n" + }, + { + "name": "Post-Partial Behavior", + "desc": "Delimiters set in a partial should not affect the parent template.", + "data": { + "value": "yes" + }, + "partials": { + "include": ".{{value}}. {{= | | =}} .|value|." + }, + "template": "[ {{>include}} ]\n[ .{{value}}. .|value|. ]\n", + "expected": "[ .yes. .yes. ]\n[ .yes. .|value|. ]\n" + }, + { + "name": "Surrounding Whitespace", + "desc": "Surrounding whitespace should be left untouched.", + "data": { + }, + "template": "| {{=@ @=}} |", + "expected": "| |" + }, + { + "name": "Outlying Whitespace (Inline)", + "desc": "Whitespace should be left untouched.", + "data": { + }, + "template": " | {{=@ @=}}\n", + "expected": " | \n" + }, + { + "name": "Standalone Tag", + "desc": "Standalone lines should be removed from the template.", + "data": { + }, + "template": "Begin.\n{{=@ @=}}\nEnd.\n", + "expected": "Begin.\nEnd.\n" + }, + { + "name": "Indented Standalone Tag", + "desc": "Indented standalone lines should be removed from the template.", + "data": { + }, + "template": "Begin.\n {{=@ @=}}\nEnd.\n", + "expected": "Begin.\nEnd.\n" + }, + { + "name": "Standalone Line Endings", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags.", + "data": { + }, + "template": "|\r\n{{= @ @ =}}\r\n|", + "expected": "|\r\n|" + }, + { + "name": "Standalone Without Previous Line", + "desc": "Standalone tags should not require a newline to precede them.", + "data": { + }, + "template": " {{=@ @=}}\n=", + "expected": "=" + }, + { + "name": "Standalone Without Newline", + "desc": "Standalone tags should not require a newline to follow them.", + "data": { + }, + "template": "=\n {{=@ @=}}", + "expected": "=\n" + }, + { + "name": "Pair with Padding", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + }, + "template": "|{{= @ @ =}}|", + "expected": "||" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/dynamic_names.dart b/third_party/packages/mustache_template/test/specs/dynamic_names.dart new file mode 100644 index 000000000000..9365ebba0655 --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/dynamic_names.dart @@ -0,0 +1,319 @@ +// Generated from ~dynamic-names.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String DYNAMIC_NAMES = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Rationale: this special notation was introduced primarily to allow the dynamic\nloading of partials. The main advantage that this notation offers is to allow\ndynamic loading of partials, which is particularly useful in cases where\npolymorphic data needs to be rendered in different ways. Such cases would\notherwise be possible to render only with solutions that are convoluted,\ninefficient, or both.\n\nExample.\nLet's consider the following data:\n\n items: [\n { content: 'Hello, World!' },\n { url: 'http://example.com/foo.jpg' },\n { content: 'Some text' },\n { content: 'Some other text' },\n { url: 'http://example.com/bar.jpg' },\n { url: 'http://example.com/baz.jpg' },\n { content: 'Last text here' }\n ]\n\nThe goal is to render the different types of items in different ways. The\nitems having a key named `content` should be rendered with the template\n`text.mustache`:\n\n {{!text.mustache}}\n {{content}}\n\nAnd the items having a key named `url` should be rendered with the template\n`image.mustache`:\n\n {{!image.mustache}}\n \n\nThere are already several ways to achieve this goal, here below are\nillustrated and discussed the most significant solutions to this problem.\n\nUsing Pre-Processing\n\nThe idea is to use a secondary templating mechanism to dynamically generate\nthe template that will be rendered.\nThe template that our secondary templating mechanism generates might look\nlike this:\n\n {{!template.mustache}}\n {{items.1.content}}\n \n {{items.3.content}}\n {{items.4.content}}\n \n \n {{items.7.content}}\n\nThis solutions offers the advantages of having more control over the template\nand minimizing the template blocks to the essential ones.\nThe drawbacks are the rendering speed and the complexity that the secondary\ntemplating mechanism requires.\n\nUsing Lambdas\n\nThe idea is to inject functions into the data that will be later called from\nthe template.\nThis way the data will look like this:\n\n items: [\n {\n content: 'Hello, World!',\n html: function() { return '{{>text}}'; }\n },\n {\n url: 'http://example.com/foo.jpg',\n html: function() { return '{{>image}}'; }\n },\n {\n content: 'Some text',\n html: function() { return '{{>text}}'; }\n },\n {\n content: 'Some other text',\n html: function() { return '{{>text}}'; }\n },\n {\n url: 'http://example.com/bar.jpg',\n html: function() { return '{{>image}}'; }\n },\n {\n url: 'http://example.com/baz.jpg',\n html: function() { return '{{>image}}'; }\n },\n {\n content: 'Last text here',\n html: function() { return '{{>text}}'; }\n }\n ]\n\nAnd the template will look like this:\n\n {{!template.mustache}}\n {{#items}}\n {{{html}}}\n {{/items}}\n\nThe advantage this solution offers is to have a light main template.\nThe drawback is that the data needs to embed logic and template tags in\nit.\n\nUsing If-Else Blocks\n\nThe idea is to put some logic into the main template so it can select the\ntemplates at rendering time:\n\n {{!template.mustache}}\n {{#items}}\n {{#url}}\n {{>image}}\n {{/url}}\n {{#content}}\n {{>text}}\n {{/content}}\n {{/items}}\n\nThe main advantage of this solution is that it works without adding any\noverhead fields to the data. It also documents which external templates are\nappropriate for expansion in this position.\nThe drawback is that this solution isn't optimal for heterogeneous data sets\nas the main template grows linearly with the number of polymorphic variants.\n\nUsing Dynamic Names\n\nThis is the solution proposed by this spec.\nThe idea is to load partials dynamically.\nThis way the data items have to be tagged with the corresponding partial name:\n\n items: [\n { content: 'Hello, World!', dynamic: 'text' },\n { url: 'http://example.com/foo.jpg', dynamic: 'image' },\n { content: 'Some text', dynamic: 'text' },\n { content: 'Some other text', dynamic: 'text' },\n { url: 'http://example.com/bar.jpg', dynamic: 'image' },\n { url: 'http://example.com/baz.jpg', dynamic: 'image' },\n { content: 'Last text here', dynamic: 'text' }\n ]\n\nAnd the template would simple look like this:\n\n {{!template.mustache}}\n {{#items}}\n {{>*dynamic}}\n {{/items}}\n\nSummary:\n\n +----------------+---------------------+-----------------------------------+\n | Approach | Pros | Cons |\n +----------------+---------------------+-----------------------------------+\n | Pre-Processing | Essential template, | Secondary templating system |\n | | more control | needed, slower rendering |\n | Lambdas | Slim template | Data tagging, logic in data |\n | If Blocks | No data overhead, | Template linear growth |\n | | self-documenting | |\n | Dynamic Names | Slim template | Data tagging |\n +----------------+---------------------+-----------------------------------+\n\nDynamic Names are a special notation to dynamically determine a tag's content.\n\nDynamic Names MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter. A Dynamic Name consists of an asterisk,\nfollowed by a dotted name. The dotted name follows the same notation as in an\nInterpolation tag.\n\nThis tag's dotted name, which is the Dynamic Name excluding the\nleading asterisk, references a key in the context whose value will be used in\nplace of the Dynamic Name itself as content of the tag. The dotted name\nresolution produces the same value as an Interpolation tag and does not affect\nthe context for further processing.\n\nSet Delimiter tags MUST NOT affect the resolution of a Dynamic Name. The\nDynamic Names MUST be resolved against the context stack local to the tag.\nFailed resolution of the dynamic name SHOULD result in nothing being rendered.\n\nEngines that implement Dynamic Names MUST support their use in Partial tags.\nIn engines that also implement the optional inheritance spec, Dynamic Names\ninside Parent tags SHOULD be supported as well. Dynamic Names cannot be\nresolved more than once (Dynamic Names cannot be nested).\n", + "tests": [ + { + "name": "Basic Behavior - Partial", + "desc": "The asterisk operator is used for dynamic partials.", + "data": { + "dynamic": "content" + }, + "template": "\"{{>*dynamic}}\"", + "partials": { + "content": "Hello, world!" + }, + "expected": "\"Hello, world!\"" + }, + { + "name": "Basic Behavior - Name Resolution", + "desc": "The asterisk is not part of the name that will be resolved in the context.\n", + "data": { + "dynamic": "content", + "*dynamic": "wrong" + }, + "template": "\"{{>*dynamic}}\"", + "partials": { + "content": "Hello, world!", + "wrong": "Invisible" + }, + "expected": "\"Hello, world!\"" + }, + { + "name": "Context Misses - Partial", + "desc": "Failed context lookups should be considered falsey.", + "data": { + }, + "template": "\"{{>*missing}}\"", + "partials": { + "missing": "Hello, world!" + }, + "expected": "\"\"" + }, + { + "name": "Failed Lookup - Partial", + "desc": "The empty string should be used when the named partial is not found.", + "data": { + "dynamic": "content" + }, + "template": "\"{{>*dynamic}}\"", + "partials": { + "foobar": "Hello, world!" + }, + "expected": "\"\"" + }, + { + "name": "Context", + "desc": "The dynamic partial should operate within the current context.", + "data": { + "text": "Hello, world!", + "example": "partial" + }, + "template": "\"{{>*example}}\"", + "partials": { + "partial": "*{{text}}*" + }, + "expected": "\"*Hello, world!*\"" + }, + { + "name": "Dotted Names", + "desc": "The dynamic partial should operate within the current context.", + "data": { + "text": "Hello, world!", + "foo": { + "bar": { + "baz": "partial" + } + } + }, + "template": "\"{{>*foo.bar.baz}}\"", + "partials": { + "partial": "*{{text}}*" + }, + "expected": "\"*Hello, world!*\"" + }, + { + "name": "Dotted Names - Operator Precedence", + "desc": "The dotted name should be resolved entirely before being dereferenced.", + "data": { + "text": "Hello, world!", + "foo": "test", + "test": { + "bar": { + "baz": "partial" + } + } + }, + "template": "\"{{>*foo.bar.baz}}\"", + "partials": { + "partial": "*{{text}}*" + }, + "expected": "\"\"" + }, + { + "name": "Dotted Names - Failed Lookup", + "desc": "The dynamic partial should operate within the current context.", + "data": { + "foo": { + "text": "Hello, world!", + "bar": { + "baz": "partial" + } + } + }, + "template": "\"{{>*foo.bar.baz}}\"", + "partials": { + "partial": "*{{text}}*" + }, + "expected": "\"**\"" + }, + { + "name": "Dotted names - Context Stacking", + "desc": "Dotted names should not push a new frame on the context stack.", + "data": { + "section1": { + "value": "section1" + }, + "section2": { + "dynamic": "partial", + "value": "section2" + } + }, + "template": "{{#section1}}{{>*section2.dynamic}}{{/section1}}", + "partials": { + "partial": "\"{{value}}\"" + }, + "expected": "\"section1\"" + }, + { + "name": "Dotted names - Context Stacking Under Repetition", + "desc": "Dotted names should not push a new frame on the context stack.", + "data": { + "value": "test", + "section1": [ + 1, + 2 + ], + "section2": { + "dynamic": "partial", + "value": "section2" + } + }, + "template": "{{#section1}}{{>*section2.dynamic}}{{/section1}}", + "partials": { + "partial": "{{value}}" + }, + "expected": "testtest" + }, + { + "name": "Dotted names - Context Stacking Failed Lookup", + "desc": "Dotted names should resolve against the proper context stack.", + "data": { + "section1": [ + 1, + 2 + ], + "section2": { + "dynamic": "partial", + "value": "section2" + } + }, + "template": "{{#section1}}{{>*section2.dynamic}}{{/section1}}", + "partials": { + "partial": "\"{{value}}\"" + }, + "expected": "\"\"\"\"" + }, + { + "name": "Recursion", + "desc": "Dynamic partials should properly recurse.", + "data": { + "template": "node", + "content": "X", + "nodes": [ + { + "content": "Y", + "nodes": [ + + ] + } + ] + }, + "template": "{{>*template}}", + "partials": { + "node": "{{content}}<{{#nodes}}{{>*template}}{{/nodes}}>" + }, + "expected": "X>" + }, + { + "name": "Dynamic Names - Double Dereferencing", + "desc": "Dynamic Names can't be dereferenced more than once.", + "data": { + "dynamic": "test", + "test": "content" + }, + "template": "\"{{>**dynamic}}\"", + "partials": { + "content": "Hello, world!" + }, + "expected": "\"\"" + }, + { + "name": "Dynamic Names - Composed Dereferencing", + "desc": "Dotted Names are resolved entirely before dereferencing begins.", + "data": { + "foo": "fizz", + "bar": "buzz", + "fizz": { + "buzz": { + "content": null + } + } + }, + "template": "\"{{>*foo.*bar}}\"", + "partials": { + "content": "Hello, world!" + }, + "expected": "\"\"" + }, + { + "name": "Surrounding Whitespace", + "desc": "A dynamic partial should not alter surrounding whitespace; any\nwhitespace preceding the tag should be treated as indentation while any\nwhitespace succeding the tag should be left untouched.\n", + "data": { + "partial": "foobar" + }, + "template": "| {{>*partial}} |", + "partials": { + "foobar": "\t|\t" + }, + "expected": "| \t|\t |" + }, + { + "name": "Inline Indentation", + "desc": "Whitespace should be left untouched: whitespaces preceding the tag\nshould be treated as indentation.\n", + "data": { + "dynamic": "partial", + "data": "|" + }, + "template": " {{data}} {{>*dynamic}}\n", + "partials": { + "partial": ">\n>" + }, + "expected": " | >\n>\n" + }, + { + "name": "Standalone Line Endings", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags.", + "data": { + "dynamic": "partial" + }, + "template": "|\r\n{{>*dynamic}}\r\n|", + "partials": { + "partial": ">" + }, + "expected": "|\r\n>|" + }, + { + "name": "Standalone Without Previous Line", + "desc": "Standalone tags should not require a newline to precede them.", + "data": { + "dynamic": "partial" + }, + "template": " {{>*dynamic}}\n>", + "partials": { + "partial": ">\n>" + }, + "expected": " >\n >>" + }, + { + "name": "Standalone Without Newline", + "desc": "Standalone tags should not require a newline to follow them.", + "data": { + "dynamic": "partial" + }, + "template": ">\n {{>*dynamic}}", + "partials": { + "partial": ">\n>" + }, + "expected": ">\n >\n >" + }, + { + "name": "Standalone Indentation", + "desc": "Each line of the partial should be indented before rendering.", + "data": { + "dynamic": "partial", + "content": "<\n->" + }, + "template": "\\\n {{>*dynamic}}\n/\n", + "partials": { + "partial": "|\n{{{content}}}\n|\n" + }, + "expected": "\\\n |\n <\n->\n |\n/\n" + }, + { + "name": "Padding Whitespace", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + "dynamic": "partial", + "boolean": true + }, + "template": "|{{> * dynamic }}|", + "partials": { + "partial": "[]" + }, + "expected": "|[]|" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/inheritance.dart b/third_party/packages/mustache_template/test/specs/inheritance.dart new file mode 100644 index 000000000000..eb9e8fa0f364 --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/inheritance.dart @@ -0,0 +1,309 @@ +// Generated from ~inheritance.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String INHERITANCE = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Like partials, Parent tags are used to expand an external template into the\ncurrent template. Unlike partials, Parent tags may contain optional\narguments delimited by Block tags. For this reason, Parent tags may also be\nreferred to as Parametric Partials.\n\nThe Parent tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Parent tag MUST be followed by\nan End Section tag with the same content within the matching Parent tag.\n\nThis tag's content names the Parent template to inject. Set Delimiter tags\nPreceding a Parent tag MUST NOT affect the parsing of the injected external\ntemplate. The Parent MUST be rendered against the context stack local to the\ntag. If the named Parent cannot be found, the empty string SHOULD be used\ninstead, as in interpolations.\n\nParent tags SHOULD be treated as standalone when appropriate. If this tag is\nused standalone, any whitespace preceding the tag should be treated as\nindentation, and prepended to each line of the Parent before rendering.\n\nThe Block tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter. Each Block tag MUST be followed by\nan End Section tag with the same content within the matching Block tag. This\ntag's content determines the parameter or argument name.\n\nBlock tags may appear both inside and outside of Parent tags. In both cases,\nthey specify a position within the template that can be overridden; it is a\nparameter of the containing template. The template text between the Block tag\nand its matching End Section tag defines the default content to render when\nthe parameter is not overridden from outside.\n\nIn addition, when used inside of a Parent tag, the template text between a\nBlock tag and its matching End Section tag defines content that replaces the\ndefault defined in the Parent template. This content is the argument passed\nto the Parent template.\n\nThe practice of injecting an external template using a Parent tag is referred\nto as inheritance. If the Parent tag includes a Block tag that overrides a\nparameter of the Parent template, this may also be referred to as\nsubstitution.\n\nParent templates are taken from the same namespace as regular Partial\ntemplates and in fact, injecting a regular Partial is exactly equivalent to\ninjecting a Parent without making any substitutions. Parameter and arguments\nnames live in a namespace that is distinct from both Partials and the context.\n", + "tests": [ + { + "name": "Default", + "desc": "Default content should be rendered if the block isn't overridden", + "data": { + }, + "template": "{{$title}}Default title{{/title}}\n", + "expected": "Default title\n" + }, + { + "name": "Variable", + "desc": "Default content renders variables", + "data": { + "bar": "baz" + }, + "template": "{{$foo}}default {{bar}} content{{/foo}}\n", + "expected": "default baz content\n" + }, + { + "name": "Triple Mustache", + "desc": "Default content renders triple mustache variables", + "data": { + "bar": "" + }, + "template": "{{$foo}}default {{{bar}}} content{{/foo}}\n", + "expected": "default content\n" + }, + { + "name": "Sections", + "desc": "Default content renders sections", + "data": { + "bar": { + "baz": "qux" + } + }, + "template": "{{$foo}}default {{#bar}}{{baz}}{{/bar}} content{{/foo}}\n", + "expected": "default qux content\n" + }, + { + "name": "Negative Sections", + "desc": "Default content renders negative sections", + "data": { + "baz": "three" + }, + "template": "{{$foo}}default {{^bar}}{{baz}}{{/bar}} content{{/foo}}\n", + "expected": "default three content\n" + }, + { + "name": "Mustache Injection", + "desc": "Mustache injection in default content", + "data": { + "bar": { + "baz": "{{qux}}" + } + }, + "template": "{{$foo}}default {{#bar}}{{baz}}{{/bar}} content{{/foo}}\n", + "expected": "default {{qux}} content\n" + }, + { + "name": "Inherit", + "desc": "Default content rendered inside inherited templates", + "data": { + }, + "template": "{{parent}}|{{" + }, + "template": "These characters should be HTML escaped: {{forbidden}}\n", + "expected": "These characters should be HTML escaped: & " < >\n" + }, + { + "name": "Triple Mustache", + "desc": "Triple mustaches should interpolate without HTML escaping.", + "data": { + "forbidden": "& \" < >" + }, + "template": "These characters should not be HTML escaped: {{{forbidden}}}\n", + "expected": "These characters should not be HTML escaped: & \" < >\n" + }, + { + "name": "Ampersand", + "desc": "Ampersand should interpolate without HTML escaping.", + "data": { + "forbidden": "& \" < >" + }, + "template": "These characters should not be HTML escaped: {{&forbidden}}\n", + "expected": "These characters should not be HTML escaped: & \" < >\n" + }, + { + "name": "Basic Integer Interpolation", + "desc": "Integers should interpolate seamlessly.", + "data": { + "mph": 85 + }, + "template": "\"{{mph}} miles an hour!\"", + "expected": "\"85 miles an hour!\"" + }, + { + "name": "Triple Mustache Integer Interpolation", + "desc": "Integers should interpolate seamlessly.", + "data": { + "mph": 85 + }, + "template": "\"{{{mph}}} miles an hour!\"", + "expected": "\"85 miles an hour!\"" + }, + { + "name": "Ampersand Integer Interpolation", + "desc": "Integers should interpolate seamlessly.", + "data": { + "mph": 85 + }, + "template": "\"{{&mph}} miles an hour!\"", + "expected": "\"85 miles an hour!\"" + }, + { + "name": "Basic Decimal Interpolation", + "desc": "Decimals should interpolate seamlessly with proper significance.", + "data": { + "power": 1.21 + }, + "template": "\"{{power}} jiggawatts!\"", + "expected": "\"1.21 jiggawatts!\"" + }, + { + "name": "Triple Mustache Decimal Interpolation", + "desc": "Decimals should interpolate seamlessly with proper significance.", + "data": { + "power": 1.21 + }, + "template": "\"{{{power}}} jiggawatts!\"", + "expected": "\"1.21 jiggawatts!\"" + }, + { + "name": "Ampersand Decimal Interpolation", + "desc": "Decimals should interpolate seamlessly with proper significance.", + "data": { + "power": 1.21 + }, + "template": "\"{{&power}} jiggawatts!\"", + "expected": "\"1.21 jiggawatts!\"" + }, + { + "name": "Basic Null Interpolation", + "desc": "Nulls should interpolate as the empty string.", + "data": { + "cannot": null + }, + "template": "I ({{cannot}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Triple Mustache Null Interpolation", + "desc": "Nulls should interpolate as the empty string.", + "data": { + "cannot": null + }, + "template": "I ({{{cannot}}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Ampersand Null Interpolation", + "desc": "Nulls should interpolate as the empty string.", + "data": { + "cannot": null + }, + "template": "I ({{&cannot}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Basic Context Miss Interpolation", + "desc": "Failed context lookups should default to empty strings.", + "data": { + }, + "template": "I ({{cannot}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Triple Mustache Context Miss Interpolation", + "desc": "Failed context lookups should default to empty strings.", + "data": { + }, + "template": "I ({{{cannot}}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Ampersand Context Miss Interpolation", + "desc": "Failed context lookups should default to empty strings.", + "data": { + }, + "template": "I ({{&cannot}}) be seen!", + "expected": "I () be seen!" + }, + { + "name": "Dotted Names - Basic Interpolation", + "desc": "Dotted names should be considered a form of shorthand for sections.", + "data": { + "person": { + "name": "Joe" + } + }, + "template": "\"{{person.name}}\" == \"{{#person}}{{name}}{{/person}}\"", + "expected": "\"Joe\" == \"Joe\"" + }, + { + "name": "Dotted Names - Triple Mustache Interpolation", + "desc": "Dotted names should be considered a form of shorthand for sections.", + "data": { + "person": { + "name": "Joe" + } + }, + "template": "\"{{{person.name}}}\" == \"{{#person}}{{{name}}}{{/person}}\"", + "expected": "\"Joe\" == \"Joe\"" + }, + { + "name": "Dotted Names - Ampersand Interpolation", + "desc": "Dotted names should be considered a form of shorthand for sections.", + "data": { + "person": { + "name": "Joe" + } + }, + "template": "\"{{&person.name}}\" == \"{{#person}}{{&name}}{{/person}}\"", + "expected": "\"Joe\" == \"Joe\"" + }, + { + "name": "Dotted Names - Arbitrary Depth", + "desc": "Dotted names should be functional to any level of nesting.", + "data": { + "a": { + "b": { + "c": { + "d": { + "e": { + "name": "Phil" + } + } + } + } + } + }, + "template": "\"{{a.b.c.d.e.name}}\" == \"Phil\"", + "expected": "\"Phil\" == \"Phil\"" + }, + { + "name": "Dotted Names - Broken Chains", + "desc": "Any falsey value prior to the last part of the name should yield ''.", + "data": { + "a": { + } + }, + "template": "\"{{a.b.c}}\" == \"\"", + "expected": "\"\" == \"\"" + }, + { + "name": "Dotted Names - Broken Chain Resolution", + "desc": "Each part of a dotted name should resolve only against its parent.", + "data": { + "a": { + "b": { + } + }, + "c": { + "name": "Jim" + } + }, + "template": "\"{{a.b.c.name}}\" == \"\"", + "expected": "\"\" == \"\"" + }, + { + "name": "Dotted Names - Initial Resolution", + "desc": "The first part of a dotted name should resolve as any other name.", + "data": { + "a": { + "b": { + "c": { + "d": { + "e": { + "name": "Phil" + } + } + } + } + }, + "b": { + "c": { + "d": { + "e": { + "name": "Wrong" + } + } + } + } + }, + "template": "\"{{#a}}{{b.c.d.e.name}}{{/a}}\" == \"Phil\"", + "expected": "\"Phil\" == \"Phil\"" + }, + { + "name": "Dotted Names - Context Precedence", + "desc": "Dotted names should be resolved against former resolutions.", + "data": { + "a": { + "b": { + } + }, + "b": { + "c": "ERROR" + } + }, + "template": "{{#a}}{{b.c}}{{/a}}", + "expected": "" + }, + { + "name": "Dotted Names are never single keys", + "desc": "Dotted names shall not be parsed as single, atomic keys", + "data": { + "a.b": "c" + }, + "template": "{{a.b}}", + "expected": "" + }, + { + "name": "Dotted Names - No Masking", + "desc": "Dotted Names in a given context are unvavailable due to dot splitting", + "data": { + "a.b": "c", + "a": { + "b": "d" + } + }, + "template": "{{a.b}}", + "expected": "d" + }, + { + "name": "Implicit Iterators - Basic Interpolation", + "desc": "Unadorned tags should interpolate content into the template.", + "data": "world", + "template": "Hello, {{.}}!\n", + "expected": "Hello, world!\n" + }, + { + "name": "Implicit Iterators - HTML Escaping", + "desc": "Basic interpolation should be HTML escaped.", + "data": "& \" < >", + "template": "These characters should be HTML escaped: {{.}}\n", + "expected": "These characters should be HTML escaped: & " < >\n" + }, + { + "name": "Implicit Iterators - Triple Mustache", + "desc": "Triple mustaches should interpolate without HTML escaping.", + "data": "& \" < >", + "template": "These characters should not be HTML escaped: {{{.}}}\n", + "expected": "These characters should not be HTML escaped: & \" < >\n" + }, + { + "name": "Implicit Iterators - Ampersand", + "desc": "Ampersand should interpolate without HTML escaping.", + "data": "& \" < >", + "template": "These characters should not be HTML escaped: {{&.}}\n", + "expected": "These characters should not be HTML escaped: & \" < >\n" + }, + { + "name": "Implicit Iterators - Basic Integer Interpolation", + "desc": "Integers should interpolate seamlessly.", + "data": 85, + "template": "\"{{.}} miles an hour!\"", + "expected": "\"85 miles an hour!\"" + }, + { + "name": "Interpolation - Surrounding Whitespace", + "desc": "Interpolation should not alter surrounding whitespace.", + "data": { + "string": "---" + }, + "template": "| {{string}} |", + "expected": "| --- |" + }, + { + "name": "Triple Mustache - Surrounding Whitespace", + "desc": "Interpolation should not alter surrounding whitespace.", + "data": { + "string": "---" + }, + "template": "| {{{string}}} |", + "expected": "| --- |" + }, + { + "name": "Ampersand - Surrounding Whitespace", + "desc": "Interpolation should not alter surrounding whitespace.", + "data": { + "string": "---" + }, + "template": "| {{&string}} |", + "expected": "| --- |" + }, + { + "name": "Interpolation - Standalone", + "desc": "Standalone interpolation should not alter surrounding whitespace.", + "data": { + "string": "---" + }, + "template": " {{string}}\n", + "expected": " ---\n" + }, + { + "name": "Triple Mustache - Standalone", + "desc": "Standalone interpolation should not alter surrounding whitespace.", + "data": { + "string": "---" + }, + "template": " {{{string}}}\n", + "expected": " ---\n" + }, + { + "name": "Ampersand - Standalone", + "desc": "Standalone interpolation should not alter surrounding whitespace.", + "data": { + "string": "---" + }, + "template": " {{&string}}\n", + "expected": " ---\n" + }, + { + "name": "Interpolation With Padding", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + "string": "---" + }, + "template": "|{{ string }}|", + "expected": "|---|" + }, + { + "name": "Triple Mustache With Padding", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + "string": "---" + }, + "template": "|{{{ string }}}|", + "expected": "|---|" + }, + { + "name": "Ampersand With Padding", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + "string": "---" + }, + "template": "|{{& string }}|", + "expected": "|---|" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/inverted.dart b/third_party/packages/mustache_template/test/specs/inverted.dart new file mode 100644 index 000000000000..2480914d9231 --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/inverted.dart @@ -0,0 +1,230 @@ +// Generated from inverted.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String INVERTED = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Inverted Section tags and End Section tags are used in combination to wrap a\nsection of the template.\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Inverted Section tag MUST be\nfollowed by an End Section tag with the same content within the same\nsection.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated with the\n name.\n 4) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 5) Otherwise, the data is the value returned by calling the method with\n the given name.\n 6) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nThis section MUST NOT be rendered unless the data list is empty.\n\nInverted Section and End Section tags SHOULD be treated as standalone when\nappropriate.\n", + "tests": [ + { + "name": "Falsey", + "desc": "Falsey sections should have their contents rendered.", + "data": { + "boolean": false + }, + "template": "\"{{^boolean}}This should be rendered.{{/boolean}}\"", + "expected": "\"This should be rendered.\"" + }, + { + "name": "Truthy", + "desc": "Truthy sections should have their contents omitted.", + "data": { + "boolean": true + }, + "template": "\"{{^boolean}}This should not be rendered.{{/boolean}}\"", + "expected": "\"\"" + }, + { + "name": "Null is falsey", + "desc": "Null is falsey.", + "data": { + "null": null + }, + "template": "\"{{^null}}This should be rendered.{{/null}}\"", + "expected": "\"This should be rendered.\"" + }, + { + "name": "Context", + "desc": "Objects and hashes should behave like truthy values.", + "data": { + "context": { + "name": "Joe" + } + }, + "template": "\"{{^context}}Hi {{name}}.{{/context}}\"", + "expected": "\"\"" + }, + { + "name": "List", + "desc": "Lists should behave like truthy values.", + "data": { + "list": [ + { + "n": 1 + }, + { + "n": 2 + }, + { + "n": 3 + } + ] + }, + "template": "\"{{^list}}{{n}}{{/list}}\"", + "expected": "\"\"" + }, + { + "name": "Empty List", + "desc": "Empty lists should behave like falsey values.", + "data": { + "list": [ + + ] + }, + "template": "\"{{^list}}Yay lists!{{/list}}\"", + "expected": "\"Yay lists!\"" + }, + { + "name": "Doubled", + "desc": "Multiple inverted sections per template should be permitted.", + "data": { + "bool": false, + "two": "second" + }, + "template": "{{^bool}}\n* first\n{{/bool}}\n* {{two}}\n{{^bool}}\n* third\n{{/bool}}\n", + "expected": "* first\n* second\n* third\n" + }, + { + "name": "Nested (Falsey)", + "desc": "Nested falsey sections should have their contents rendered.", + "data": { + "bool": false + }, + "template": "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |", + "expected": "| A B C D E |" + }, + { + "name": "Nested (Truthy)", + "desc": "Nested truthy sections should be omitted.", + "data": { + "bool": true + }, + "template": "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |", + "expected": "| A E |" + }, + { + "name": "Context Misses", + "desc": "Failed context lookups should be considered falsey.", + "data": { + }, + "template": "[{{^missing}}Cannot find key 'missing'!{{/missing}}]", + "expected": "[Cannot find key 'missing'!]" + }, + { + "name": "Dotted Names - Truthy", + "desc": "Dotted names should be valid for Inverted Section tags.", + "data": { + "a": { + "b": { + "c": true + } + } + }, + "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"\"", + "expected": "\"\" == \"\"" + }, + { + "name": "Dotted Names - Falsey", + "desc": "Dotted names should be valid for Inverted Section tags.", + "data": { + "a": { + "b": { + "c": false + } + } + }, + "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"", + "expected": "\"Not Here\" == \"Not Here\"" + }, + { + "name": "Dotted Names - Broken Chains", + "desc": "Dotted names that cannot be resolved should be considered falsey.", + "data": { + "a": { + } + }, + "template": "\"{{^a.b.c}}Not Here{{/a.b.c}}\" == \"Not Here\"", + "expected": "\"Not Here\" == \"Not Here\"" + }, + { + "name": "Surrounding Whitespace", + "desc": "Inverted sections should not alter surrounding whitespace.", + "data": { + "boolean": false + }, + "template": " | {{^boolean}}\t|\t{{/boolean}} | \n", + "expected": " | \t|\t | \n" + }, + { + "name": "Internal Whitespace", + "desc": "Inverted should not alter internal whitespace.", + "data": { + "boolean": false + }, + "template": " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n", + "expected": " | \n | \n" + }, + { + "name": "Indented Inline Sections", + "desc": "Single-line sections should not alter surrounding whitespace.", + "data": { + "boolean": false + }, + "template": " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n", + "expected": " NO\n WAY\n" + }, + { + "name": "Standalone Lines", + "desc": "Standalone lines should be removed from the template.", + "data": { + "boolean": false + }, + "template": "| This Is\n{{^boolean}}\n|\n{{/boolean}}\n| A Line\n", + "expected": "| This Is\n|\n| A Line\n" + }, + { + "name": "Standalone Indented Lines", + "desc": "Standalone indented lines should be removed from the template.", + "data": { + "boolean": false + }, + "template": "| This Is\n {{^boolean}}\n|\n {{/boolean}}\n| A Line\n", + "expected": "| This Is\n|\n| A Line\n" + }, + { + "name": "Standalone Line Endings", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags.", + "data": { + "boolean": false + }, + "template": "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|", + "expected": "|\r\n|" + }, + { + "name": "Standalone Without Previous Line", + "desc": "Standalone tags should not require a newline to precede them.", + "data": { + "boolean": false + }, + "template": " {{^boolean}}\n^{{/boolean}}\n/", + "expected": "^\n/" + }, + { + "name": "Standalone Without Newline", + "desc": "Standalone tags should not require a newline to follow them.", + "data": { + "boolean": false + }, + "template": "^{{^boolean}}\n/\n {{/boolean}}", + "expected": "^\n/\n" + }, + { + "name": "Padding", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + "boolean": false + }, + "template": "|{{^ boolean }}={{/ boolean }}|", + "expected": "|=|" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/lambdas.dart b/third_party/packages/mustache_template/test/specs/lambdas.dart new file mode 100644 index 000000000000..319b65c3374b --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/lambdas.dart @@ -0,0 +1,235 @@ +// Generated from ~lambdas.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String LAMBDAS = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Lambdas are a special-cased data type for use in interpolations and\nsections.\n\nWhen used as the data value for an Interpolation tag, the lambda MUST be\ntreatable as an arity 0 function, and invoked as such. The returned value\nMUST be rendered against the default delimiters, then interpolated in place\nof the lambda.\n\nWhen used as the data value for a Section tag, the lambda MUST be treatable\nas an arity 1 function, and invoked as such (passing a String containing the\nunprocessed section contents). The returned value MUST be rendered against\nthe current delimiters, then interpolated in place of the section.\n", + "tests": [ + { + "name": "Interpolation", + "desc": "A lambda's return value should be interpolated.", + "data": { + "lambda": { + "__tag__": "code", + "ruby": "proc { \"world\" }", + "raku": "sub { \"world\" }", + "perl": "sub { \"world\" }", + "js": "function() { return \"world\" }", + "php": "return \"world\";", + "python": "lambda: \"world\"", + "clojure": "(fn [] \"world\")", + "lisp": "(lambda () \"world\")", + "pwsh": "\"world\"", + "go": "func() string { return \"world\" }", + "erlang": "fun() -> \"world\" end." + } + }, + "template": "Hello, {{lambda}}!", + "expected": "Hello, world!" + }, + { + "name": "Interpolation - Expansion", + "desc": "A lambda's return value should be parsed.", + "data": { + "planet": "world", + "lambda": { + "__tag__": "code", + "ruby": "proc { \"{{planet}}\" }", + "raku": "sub { q+{{planet}}+ }", + "perl": "sub { \"{{planet}}\" }", + "js": "function() { return \"{{planet}}\" }", + "php": "return \"{{planet}}\";", + "python": "lambda: \"{{planet}}\"", + "clojure": "(fn [] \"{{planet}}\")", + "lisp": "(lambda () \"{{planet}}\")", + "pwsh": "\"{{planet}}\"", + "go": "func() string { return \"{{planet}}\" }", + "erlang": "fun() -> \"{{planet}}\" end." + } + }, + "template": "Hello, {{lambda}}!", + "expected": "Hello, world!" + }, + { + "name": "Interpolation - Alternate Delimiters", + "desc": "A lambda's return value should parse with the default delimiters.", + "data": { + "planet": "world", + "lambda": { + "__tag__": "code", + "ruby": "proc { \"|planet| => {{planet}}\" }", + "raku": "sub { q+|planet| => {{planet}}+ }", + "perl": "sub { \"|planet| => {{planet}}\" }", + "js": "function() { return \"|planet| => {{planet}}\" }", + "php": "return \"|planet| => {{planet}}\";", + "python": "lambda: \"|planet| => {{planet}}\"", + "clojure": "(fn [] \"|planet| => {{planet}}\")", + "lisp": "(lambda () \"|planet| => {{planet}}\")", + "pwsh": "\"|planet| => {{planet}}\"", + "go": "func() string { return \"|planet| => {{planet}}\" }", + "erlang": "fun() -> \"|planet| => {{planet}}\" end." + } + }, + "template": "{{= | | =}}\nHello, (|&lambda|)!", + "expected": "Hello, (|planet| => world)!" + }, + { + "name": "Interpolation - Multiple Calls", + "desc": "Interpolated lambdas should not be cached.", + "data": { + "lambda": { + "__tag__": "code", + "ruby": "proc { $calls ||= 0; $calls += 1 }", + "raku": "sub { state $calls += 1 }", + "perl": "sub { no strict; $calls += 1 }", + "js": "function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }", + "php": "global $calls; return ++$calls;", + "python": "lambda: globals().update(calls=globals().get(\"calls\",0)+1) or calls", + "clojure": "(def g (atom 0)) (fn [] (swap! g inc))", + "lisp": "(let ((g 0)) (lambda () (incf g)))", + "pwsh": "if (($null -eq $script:calls) -or ($script:calls -ge 3)){$script:calls=0}; ++$script:calls; $script:calls", + "go": "func() func() int { g := 0; return func() int { g++; return g } }()", + "erlang": "fun() -> G=case get(g) of undefined -> 1; _G -> _G end, put(g, G+1), G end." + } + }, + "template": "{{lambda}} == {{{lambda}}} == {{lambda}}", + "expected": "1 == 2 == 3" + }, + { + "name": "Escaping", + "desc": "Lambda results should be appropriately escaped.", + "data": { + "lambda": { + "__tag__": "code", + "ruby": "proc { \">\" }", + "raku": "sub { \">\" }", + "perl": "sub { \">\" }", + "js": "function() { return \">\" }", + "php": "return \">\";", + "python": "lambda: \">\"", + "clojure": "(fn [] \">\")", + "lisp": "(lambda () \">\")", + "pwsh": "\">\"", + "go": "func() string { return \">\" }", + "erlang": "fun() -> \">\" end." + } + }, + "template": "<{{lambda}}{{{lambda}}}", + "expected": "<>>" + }, + { + "name": "Section", + "desc": "Lambdas used for sections should receive the raw section string.", + "data": { + "x": "Error!", + "lambda": { + "__tag__": "code", + "ruby": "proc { |text| text == \"{{x}}\" ? \"yes\" : \"no\" }", + "raku": "sub { $^section eq q+{{x}}+ ?? \"yes\" !! \"no\" }", + "perl": "sub { $_[0] eq \"{{x}}\" ? \"yes\" : \"no\" }", + "js": "function(txt) { return (txt == \"{{x}}\" ? \"yes\" : \"no\") }", + "php": "return ($text == \"{{x}}\") ? \"yes\" : \"no\";", + "python": "lambda text: text == \"{{x}}\" and \"yes\" or \"no\"", + "clojure": "(fn [text] (if (= text \"{{x}}\") \"yes\" \"no\"))", + "lisp": "(lambda (text) (if (string= text \"{{x}}\") \"yes\" \"no\"))", + "pwsh": "if ($args[0] -eq \"{{x}}\") {\"yes\"} else {\"no\"}", + "go": "func(text string) string { if text == \"{{x}}\" { return \"yes\" } else { return \"no\" } }", + "erlang": "fun(\"{{x}}\") -> \"yes\"; (_) -> \"no\" end." + } + }, + "template": "<{{#lambda}}{{x}}{{/lambda}}>", + "expected": "" + }, + { + "name": "Section - Expansion", + "desc": "Lambdas used for sections should have their results parsed.", + "data": { + "planet": "Earth", + "lambda": { + "__tag__": "code", + "ruby": "proc { |text| \"#{text}{{planet}}#{text}\" }", + "raku": "sub { $^section ~ q+{{planet}}+ ~ $^section }", + "perl": "sub { $_[0] . \"{{planet}}\" . $_[0] }", + "js": "function(txt) { return txt + \"{{planet}}\" + txt }", + "php": "return $text . \"{{planet}}\" . $text;", + "python": "lambda text: \"%s{{planet}}%s\" % (text, text)", + "clojure": "(fn [text] (str text \"{{planet}}\" text))", + "lisp": "(lambda (text) (format nil \"~a{{planet}}~a\" text text))", + "pwsh": "\"$($args[0]){{planet}}$($args[0])\"", + "go": "func(text string) string { return text + \"{{planet}}\" + text }", + "erlang": "fun(Text) -> Text ++ \"{{planet}}\" ++ Text end." + } + }, + "template": "<{{#lambda}}-{{/lambda}}>", + "expected": "<-Earth->" + }, + { + "name": "Section - Alternate Delimiters", + "desc": "Lambdas used for sections should parse with the current delimiters.", + "data": { + "planet": "Earth", + "lambda": { + "__tag__": "code", + "ruby": "proc { |text| \"#{text}{{planet}} => |planet|#{text}\" }", + "raku": "sub { $^section ~ q+{{planet}} => |planet|+ ~ $^section }", + "perl": "sub { $_[0] . \"{{planet}} => |planet|\" . $_[0] }", + "js": "function(txt) { return txt + \"{{planet}} => |planet|\" + txt }", + "php": "return $text . \"{{planet}} => |planet|\" . $text;", + "python": "lambda text: \"%s{{planet}} => |planet|%s\" % (text, text)", + "clojure": "(fn [text] (str text \"{{planet}} => |planet|\" text))", + "lisp": "(lambda (text) (format nil \"~a{{planet}} => |planet|~a\" text text))", + "pwsh": "\"$($args[0]){{planet}} => |planet|$($args[0])\"", + "go": "func(text string) string { return text + \"{{planet}} => |planet|\" + text }", + "erlang": "fun(Text) -> Text ++ \"{{planet}} => |planet|\" ++ Text end." + } + }, + "template": "{{= | | =}}<|#lambda|-|/lambda|>", + "expected": "<-{{planet}} => Earth->" + }, + { + "name": "Section - Multiple Calls", + "desc": "Lambdas used for sections should not be cached.", + "data": { + "lambda": { + "__tag__": "code", + "ruby": "proc { |text| \"__#{text}__\" }", + "raku": "sub { \"__\" ~ $^section ~ \"__\" }", + "perl": "sub { \"__\" . $_[0] . \"__\" }", + "js": "function(txt) { return \"__\" + txt + \"__\" }", + "php": "return \"__\" . $text . \"__\";", + "python": "lambda text: \"__%s__\" % (text)", + "clojure": "(fn [text] (str \"__\" text \"__\"))", + "lisp": "(lambda (text) (format nil \"__~a__\" text))", + "pwsh": "\"__$($args[0])__\"", + "go": "func(text string) string { return \"__\" + text + \"__\" }", + "erlang": "fun(Text) -> \"__\" ++ Text ++ \"__\" end." + } + }, + "template": "{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}", + "expected": "__FILE__ != __LINE__" + }, + { + "name": "Inverted Section", + "desc": "Lambdas used for inverted sections should be considered truthy.", + "data": { + "static": "static", + "lambda": { + "__tag__": "code", + "ruby": "proc { |text| false }", + "raku": "sub { 0 }", + "perl": "sub { 0 }", + "js": "function(txt) { return false }", + "php": "return false;", + "python": "lambda text: 0", + "clojure": "(fn [text] false)", + "lisp": "(lambda (text) (declare (ignore text)) nil)", + "pwsh": "$false", + "go": "func(text string) bool { return false }", + "erlang": "fun(_) -> false end." + } + }, + "template": "<{{^lambda}}{{static}}{{/lambda}}>", + "expected": "<>" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/partials.dart b/third_party/packages/mustache_template/test/specs/partials.dart new file mode 100644 index 000000000000..062f435e7f01 --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/partials.dart @@ -0,0 +1,156 @@ +// Generated from partials.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String PARTIALS = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Partial tags are used to expand an external template into the current\ntemplate.\n\nThe tag's content MUST be a non-whitespace character sequence NOT containing\nthe current closing delimiter.\n\nThis tag's content names the partial to inject. Set Delimiter tags MUST NOT\naffect the parsing of a partial. The partial MUST be rendered against the\ncontext stack local to the tag. If the named partial cannot be found, the\nempty string SHOULD be used instead, as in interpolations.\n\nPartial tags SHOULD be treated as standalone when appropriate. If this tag\nis used standalone, any whitespace preceding the tag should treated as\nindentation, and prepended to each line of the partial before rendering.\n", + "tests": [ + { + "name": "Basic Behavior", + "desc": "The greater-than operator should expand to the named partial.", + "data": { + }, + "template": "\"{{>text}}\"", + "partials": { + "text": "from partial" + }, + "expected": "\"from partial\"" + }, + { + "name": "Failed Lookup", + "desc": "The empty string should be used when the named partial is not found.", + "data": { + }, + "template": "\"{{>text}}\"", + "partials": { + }, + "expected": "\"\"" + }, + { + "name": "Context", + "desc": "The greater-than operator should operate within the current context.", + "data": { + "text": "content" + }, + "template": "\"{{>partial}}\"", + "partials": { + "partial": "*{{text}}*" + }, + "expected": "\"*content*\"" + }, + { + "name": "Recursion", + "desc": "The greater-than operator should properly recurse.", + "data": { + "content": "X", + "nodes": [ + { + "content": "Y", + "nodes": [ + + ] + } + ] + }, + "template": "{{>node}}", + "partials": { + "node": "{{content}}<{{#nodes}}{{>node}}{{/nodes}}>" + }, + "expected": "X>" + }, + { + "name": "Nested", + "desc": "The greater-than operator should work from within partials.", + "data": { + "a": "hello", + "b": "world" + }, + "template": "{{>outer}}", + "partials": { + "outer": "*{{a}} {{>inner}}*", + "inner": "{{b}}!" + }, + "expected": "*hello world!*" + }, + { + "name": "Surrounding Whitespace", + "desc": "The greater-than operator should not alter surrounding whitespace.", + "data": { + }, + "template": "| {{>partial}} |", + "partials": { + "partial": "\t|\t" + }, + "expected": "| \t|\t |" + }, + { + "name": "Inline Indentation", + "desc": "Whitespace should be left untouched.", + "data": { + "data": "|" + }, + "template": " {{data}} {{> partial}}\n", + "partials": { + "partial": ">\n>" + }, + "expected": " | >\n>\n" + }, + { + "name": "Standalone Line Endings", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags.", + "data": { + }, + "template": "|\r\n{{>partial}}\r\n|", + "partials": { + "partial": ">" + }, + "expected": "|\r\n>|" + }, + { + "name": "Standalone Without Previous Line", + "desc": "Standalone tags should not require a newline to precede them.", + "data": { + }, + "template": " {{>partial}}\n>", + "partials": { + "partial": ">\n>" + }, + "expected": " >\n >>" + }, + { + "name": "Standalone Without Newline", + "desc": "Standalone tags should not require a newline to follow them.", + "data": { + }, + "template": ">\n {{>partial}}", + "partials": { + "partial": ">\n>" + }, + "expected": ">\n >\n >" + }, + { + "name": "Standalone Indentation", + "desc": "Each line of the partial should be indented before rendering.", + "data": { + "content": "<\n->" + }, + "template": "\\\n {{>partial}}\n/\n", + "partials": { + "partial": "|\n{{{content}}}\n|\n" + }, + "expected": "\\\n |\n <\n->\n |\n/\n" + }, + { + "name": "Padding Whitespace", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + "boolean": true + }, + "template": "|{{> partial }}|", + "partials": { + "partial": "[]" + }, + "expected": "|[]|" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/sections.dart b/third_party/packages/mustache_template/test/specs/sections.dart new file mode 100644 index 000000000000..4da83ca699a6 --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/sections.dart @@ -0,0 +1,426 @@ +// Generated from sections.json@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +const String SECTIONS = r''' +{ + "__ATTN__": "Do not edit this file; changes belong in the appropriate YAML file.", + "overview": "Section tags and End Section tags are used in combination to wrap a section\nof the template for iteration.\n\nThese tags' content MUST be a non-whitespace character sequence NOT\ncontaining the current closing delimiter; each Section tag MUST be followed\nby an End Section tag with the same content within the same section.\n\nThis tag's content names the data to replace the tag. Name resolution is as\nfollows:\n 1) If the name is a single period (.), the data is the item currently\n sitting atop the context stack. Skip the rest of these steps.\n 2) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 3) Walk the context stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 4) If the context is a hash, the data is the value associated with the\n name.\n 5) If the context is an object and the method with the given name has an\n arity of 1, the method SHOULD be called with a String containing the\n unprocessed contents of the sections; the data is the value returned.\n 6) Otherwise, the data is the value returned by calling the method with\n the given name.\n 7) If any name parts were retained in step 1, each should be resolved\n against a context stack containing only the result from the former\n resolution. If any part fails resolution, the result should be considered\n falsey, and should interpolate as the empty string.\n\nIf the data is not of a list type, it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty list.\n\nFor each element in the data list, the element MUST be pushed onto the\ncontext stack, the section MUST be rendered, and the element MUST be popped\noff the context stack.\n\nSection and End Section tags SHOULD be treated as standalone when\nappropriate.\n", + "tests": [ + { + "name": "Truthy", + "desc": "Truthy sections should have their contents rendered.", + "data": { + "boolean": true + }, + "template": "\"{{#boolean}}This should be rendered.{{/boolean}}\"", + "expected": "\"This should be rendered.\"" + }, + { + "name": "Falsey", + "desc": "Falsey sections should have their contents omitted.", + "data": { + "boolean": false + }, + "template": "\"{{#boolean}}This should not be rendered.{{/boolean}}\"", + "expected": "\"\"" + }, + { + "name": "Null is falsey", + "desc": "Null is falsey.", + "data": { + "null": null + }, + "template": "\"{{#null}}This should not be rendered.{{/null}}\"", + "expected": "\"\"" + }, + { + "name": "Context", + "desc": "Objects and hashes should be pushed onto the context stack.", + "data": { + "context": { + "name": "Joe" + } + }, + "template": "\"{{#context}}Hi {{name}}.{{/context}}\"", + "expected": "\"Hi Joe.\"" + }, + { + "name": "Parent contexts", + "desc": "Names missing in the current context are looked up in the stack.", + "data": { + "a": "foo", + "b": "wrong", + "sec": { + "b": "bar" + }, + "c": { + "d": "baz" + } + }, + "template": "\"{{#sec}}{{a}}, {{b}}, {{c.d}}{{/sec}}\"", + "expected": "\"foo, bar, baz\"" + }, + { + "name": "Variable test", + "desc": "Non-false sections have their value at the top of context,\naccessible as {{.}} or through the parent context. This gives\na simple way to display content conditionally if a variable exists.\n", + "data": { + "foo": "bar" + }, + "template": "\"{{#foo}}{{.}} is {{foo}}{{/foo}}\"", + "expected": "\"bar is bar\"" + }, + { + "name": "List Contexts", + "desc": "All elements on the context stack should be accessible within lists.", + "data": { + "tops": [ + { + "tname": { + "upper": "A", + "lower": "a" + }, + "middles": [ + { + "mname": "1", + "bottoms": [ + { + "bname": "x" + }, + { + "bname": "y" + } + ] + } + ] + } + ] + }, + "template": "{{#tops}}{{#middles}}{{tname.lower}}{{mname}}.{{#bottoms}}{{tname.upper}}{{mname}}{{bname}}.{{/bottoms}}{{/middles}}{{/tops}}", + "expected": "a1.A1x.A1y." + }, + { + "name": "Deeply Nested Contexts", + "desc": "All elements on the context stack should be accessible.", + "data": { + "a": { + "one": 1 + }, + "b": { + "two": 2 + }, + "c": { + "three": 3, + "d": { + "four": 4, + "five": 5 + } + } + }, + "template": "{{#a}}\n{{one}}\n{{#b}}\n{{one}}{{two}}{{one}}\n{{#c}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{#d}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{#five}}\n{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}\n{{one}}{{two}}{{three}}{{four}}{{.}}6{{.}}{{four}}{{three}}{{two}}{{one}}\n{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}}\n{{/five}}\n{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}}\n{{/d}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{/c}}\n{{one}}{{two}}{{one}}\n{{/b}}\n{{one}}\n{{/a}}\n", + "expected": "1\n121\n12321\n1234321\n123454321\n12345654321\n123454321\n1234321\n12321\n121\n1\n" + }, + { + "name": "List", + "desc": "Lists should be iterated; list items should visit the context stack.", + "data": { + "list": [ + { + "item": 1 + }, + { + "item": 2 + }, + { + "item": 3 + } + ] + }, + "template": "\"{{#list}}{{item}}{{/list}}\"", + "expected": "\"123\"" + }, + { + "name": "Empty List", + "desc": "Empty lists should behave like falsey values.", + "data": { + "list": [ + + ] + }, + "template": "\"{{#list}}Yay lists!{{/list}}\"", + "expected": "\"\"" + }, + { + "name": "Doubled", + "desc": "Multiple sections per template should be permitted.", + "data": { + "bool": true, + "two": "second" + }, + "template": "{{#bool}}\n* first\n{{/bool}}\n* {{two}}\n{{#bool}}\n* third\n{{/bool}}\n", + "expected": "* first\n* second\n* third\n" + }, + { + "name": "Nested (Truthy)", + "desc": "Nested truthy sections should have their contents rendered.", + "data": { + "bool": true + }, + "template": "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |", + "expected": "| A B C D E |" + }, + { + "name": "Nested (Falsey)", + "desc": "Nested falsey sections should be omitted.", + "data": { + "bool": false + }, + "template": "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |", + "expected": "| A E |" + }, + { + "name": "Context Misses", + "desc": "Failed context lookups should be considered falsey.", + "data": { + }, + "template": "[{{#missing}}Found key 'missing'!{{/missing}}]", + "expected": "[]" + }, + { + "name": "Implicit Iterator - String", + "desc": "Implicit iterators should directly interpolate strings.", + "data": { + "list": [ + "a", + "b", + "c", + "d", + "e" + ] + }, + "template": "\"{{#list}}({{.}}){{/list}}\"", + "expected": "\"(a)(b)(c)(d)(e)\"" + }, + { + "name": "Implicit Iterator - Integer", + "desc": "Implicit iterators should cast integers to strings and interpolate.", + "data": { + "list": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "template": "\"{{#list}}({{.}}){{/list}}\"", + "expected": "\"(1)(2)(3)(4)(5)\"" + }, + { + "name": "Implicit Iterator - Decimal", + "desc": "Implicit iterators should cast decimals to strings and interpolate.", + "data": { + "list": [ + 1.1, + 2.2, + 3.3, + 4.4, + 5.5 + ] + }, + "template": "\"{{#list}}({{.}}){{/list}}\"", + "expected": "\"(1.1)(2.2)(3.3)(4.4)(5.5)\"" + }, + { + "name": "Implicit Iterator - Array", + "desc": "Implicit iterators should allow iterating over nested arrays.", + "data": { + "list": [ + [ + 1, + 2, + 3 + ], + [ + "a", + "b", + "c" + ] + ] + }, + "template": "\"{{#list}}({{#.}}{{.}}{{/.}}){{/list}}\"", + "expected": "\"(123)(abc)\"" + }, + { + "name": "Implicit Iterator - HTML Escaping", + "desc": "Implicit iterators with basic interpolation should be HTML escaped.", + "data": { + "list": [ + "&", + "\"", + "<", + ">" + ] + }, + "template": "\"{{#list}}({{.}}){{/list}}\"", + "expected": "\"(&)(")(<)(>)\"" + }, + { + "name": "Implicit Iterator - Triple mustache", + "desc": "Implicit iterators in triple mustache should interpolate without HTML escaping.", + "data": { + "list": [ + "&", + "\"", + "<", + ">" + ] + }, + "template": "\"{{#list}}({{{.}}}){{/list}}\"", + "expected": "\"(&)(\")(<)(>)\"" + }, + { + "name": "Implicit Iterator - Ampersand", + "desc": "Implicit iterators in an Ampersand tag should interpolate without HTML escaping.", + "data": { + "list": [ + "&", + "\"", + "<", + ">" + ] + }, + "template": "\"{{#list}}({{&.}}){{/list}}\"", + "expected": "\"(&)(\")(<)(>)\"" + }, + { + "name": "Implicit Iterator - Root-level", + "desc": "Implicit iterators should work on root-level lists.", + "data": [ + { + "value": "a" + }, + { + "value": "b" + } + ], + "template": "\"{{#.}}({{value}}){{/.}}\"", + "expected": "\"(a)(b)\"" + }, + { + "name": "Dotted Names - Truthy", + "desc": "Dotted names should be valid for Section tags.", + "data": { + "a": { + "b": { + "c": true + } + } + }, + "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"Here\"", + "expected": "\"Here\" == \"Here\"" + }, + { + "name": "Dotted Names - Falsey", + "desc": "Dotted names should be valid for Section tags.", + "data": { + "a": { + "b": { + "c": false + } + } + }, + "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"", + "expected": "\"\" == \"\"" + }, + { + "name": "Dotted Names - Broken Chains", + "desc": "Dotted names that cannot be resolved should be considered falsey.", + "data": { + "a": { + } + }, + "template": "\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"", + "expected": "\"\" == \"\"" + }, + { + "name": "Surrounding Whitespace", + "desc": "Sections should not alter surrounding whitespace.", + "data": { + "boolean": true + }, + "template": " | {{#boolean}}\t|\t{{/boolean}} | \n", + "expected": " | \t|\t | \n" + }, + { + "name": "Internal Whitespace", + "desc": "Sections should not alter internal whitespace.", + "data": { + "boolean": true + }, + "template": " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n", + "expected": " | \n | \n" + }, + { + "name": "Indented Inline Sections", + "desc": "Single-line sections should not alter surrounding whitespace.", + "data": { + "boolean": true + }, + "template": " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n", + "expected": " YES\n GOOD\n" + }, + { + "name": "Standalone Lines", + "desc": "Standalone lines should be removed from the template.", + "data": { + "boolean": true + }, + "template": "| This Is\n{{#boolean}}\n|\n{{/boolean}}\n| A Line\n", + "expected": "| This Is\n|\n| A Line\n" + }, + { + "name": "Indented Standalone Lines", + "desc": "Indented standalone lines should be removed from the template.", + "data": { + "boolean": true + }, + "template": "| This Is\n {{#boolean}}\n|\n {{/boolean}}\n| A Line\n", + "expected": "| This Is\n|\n| A Line\n" + }, + { + "name": "Standalone Line Endings", + "desc": "\"\\r\\n\" should be considered a newline for standalone tags.", + "data": { + "boolean": true + }, + "template": "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|", + "expected": "|\r\n|" + }, + { + "name": "Standalone Without Previous Line", + "desc": "Standalone tags should not require a newline to precede them.", + "data": { + "boolean": true + }, + "template": " {{#boolean}}\n#{{/boolean}}\n/", + "expected": "#\n/" + }, + { + "name": "Standalone Without Newline", + "desc": "Standalone tags should not require a newline to follow them.", + "data": { + "boolean": true + }, + "template": "#{{#boolean}}\n/\n {{/boolean}}", + "expected": "#\n/\n" + }, + { + "name": "Padding", + "desc": "Superfluous in-tag whitespace should be ignored.", + "data": { + "boolean": true + }, + "template": "|{{# boolean }}={{/ boolean }}|", + "expected": "|=|" + } + ] +} +'''; diff --git a/third_party/packages/mustache_template/test/specs/specs.dart b/third_party/packages/mustache_template/test/specs/specs.dart new file mode 100644 index 000000000000..a6a78288d882 --- /dev/null +++ b/third_party/packages/mustache_template/test/specs/specs.dart @@ -0,0 +1,22 @@ +// Generated from mustache/spec@97c05b0652f06ef4cbe12016b8d0e41df31c4b05 at 2026-03-09T19:49:45Z +import 'comments.dart'; +import 'delimiters.dart'; +import 'dynamic_names.dart'; +import 'inheritance.dart'; +import 'interpolation.dart'; +import 'inverted.dart'; +import 'lambdas.dart'; +import 'partials.dart'; +import 'sections.dart'; + +const Map SPECS = { + 'comments': COMMENTS, + 'delimiters': DELIMITERS, + 'dynamic_names': DYNAMIC_NAMES, + 'inheritance': INHERITANCE, + 'interpolation': INTERPOLATION, + 'inverted': INVERTED, + 'lambdas': LAMBDAS, + 'partials': PARTIALS, + 'sections': SECTIONS, +}; diff --git a/third_party/packages/mustache_template/tool/download_spec.dart b/third_party/packages/mustache_template/tool/download_spec.dart new file mode 100644 index 000000000000..58b4546ef7af --- /dev/null +++ b/third_party/packages/mustache_template/tool/download_spec.dart @@ -0,0 +1,125 @@ +import 'dart:io'; + +/// Clones the mustache/spec repository, embeds each JSON spec as a Dart raw +/// string under `test/specs/`, and writes `test/specs/specs.dart` with a +/// `SPECS` map. +/// +/// Run from the package root: +/// `dart run tool/download_spec.dart` +Future main(List args) async { + final Directory packageRoot = _packageRootDirectory(); + final testSpecsDir = Directory(_join(packageRoot.path, 'test', 'specs')); + final String tmpSpecPath = _join(packageRoot.path, 'tmp_spec'); + final tmpSpecDir = Directory(tmpSpecPath); + + if (tmpSpecDir.existsSync()) { + await tmpSpecDir.delete(recursive: true); + } + + await _runGit(packageRoot.path, [ + 'clone', + 'https://github.com/mustache/spec.git', + tmpSpecPath, + ]); + + final String headHash = + ((await _runGit(packageRoot.path, [ + '-C', + tmpSpecPath, + 'rev-parse', + 'HEAD', + ])).stdout + as String) + .trim(); + + final String utcNow = _formatUtcSecond(DateTime.now().toUtc()); + + if (testSpecsDir.existsSync()) { + await testSpecsDir.delete(recursive: true); + } + await testSpecsDir.create(recursive: true); + + final clonedSpecs = Directory(_join(tmpSpecPath, 'specs')); + final List jsonFiles = + clonedSpecs + .listSync() + .whereType() + .where((File f) => f.path.endsWith('.json')) + .toList() + ..sort((File a, File b) => a.path.compareTo(b.path)); + + final exports = StringBuffer(); + final mapEntries = StringBuffer(); + + for (final jsonFile in jsonFiles) { + final String original = jsonFile.uri.pathSegments.last; + var base = original; + if (base.endsWith('.json')) { + base = base.substring(0, base.length - '.json'.length); + } + if (base.startsWith('~')) { + base = base.substring(1); + } + final String dartName = base.replaceAll('-', '_'); + final String constName = dartName.toUpperCase(); + final String jsonText = await jsonFile.readAsString(); + + final outFile = File(_join(testSpecsDir.path, '$dartName.dart')); + await outFile.writeAsString( + '// Generated from $original@$headHash at $utcNow\n' + "const String $constName = r'''\n" + '$jsonText' + "''';\n", + ); + + exports.write("import '"); + exports.write(dartName); + exports.writeln(".dart';"); + + mapEntries.write(" '"); + mapEntries.write(dartName); + mapEntries.writeln("': $constName,"); + } + + await File(_join(testSpecsDir.path, 'specs.dart')).writeAsString( + '// Generated from mustache/spec@$headHash at $utcNow\n' + '$exports\n' + 'const Map SPECS = {\n' + '$mapEntries' + '};\n', + ); + + await Directory(tmpSpecPath).delete(recursive: true); +} + +Directory _packageRootDirectory() { + return File.fromUri(Platform.script).parent.parent; +} + +String _formatUtcSecond(DateTime dt) { + assert(dt.isUtc); + String two(int n) => n.toString().padLeft(2, '0'); + final String y = dt.year.toString().padLeft(4, '0'); + return '$y-${two(dt.month)}-${two(dt.day)}T${two(dt.hour)}:${two(dt.minute)}:${two(dt.second)}Z'; +} + +String _join(String a, String b, [String? c]) { + final String sep = Platform.pathSeparator; + return [a, b, if (c != null) c].join(sep); +} + +Future _runGit( + String workingDirectory, + List arguments, +) async { + final ProcessResult result = await Process.run( + 'git', + arguments, + workingDirectory: workingDirectory, + ); + if (result.exitCode != 0) { + stderr.writeln(result.stderr); + exit(result.exitCode); + } + return result; +}