From 071f1d5b3158f286bf85e0e652b248d1711113e4 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 11:19:00 -0400 Subject: [PATCH 01/14] Update tooling to enforce java 17 compile options and kotlinOptions --- script/tool/lib/src/gradle_check_command.dart | 48 +++++-- .../tool/test/gradle_check_command_test.dart | 120 ++++++++++++++++-- 2 files changed, 150 insertions(+), 18 deletions(-) diff --git a/script/tool/lib/src/gradle_check_command.dart b/script/tool/lib/src/gradle_check_command.dart index 0e70e5f9ba8..dc299a160b2 100644 --- a/script/tool/lib/src/gradle_check_command.dart +++ b/script/tool/lib/src/gradle_check_command.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:math' as math; + import 'package:collection/collection.dart'; import 'package:file/file.dart'; import 'package:meta/meta.dart'; @@ -354,33 +356,34 @@ build.gradle "namespace" must match the "package" attribute in AndroidManifest.x /// than using whatever the client's local toolchaing defaults to (which can /// lead to compile errors that show up for clients, but not in CI). bool _validateCompatibilityVersions(List gradleLines) { + const String requiredJavaVersion = '17'; final bool hasLanguageVersion = gradleLines.any((String line) => line.contains('languageVersion') && !_isCommented(line)); final bool hasCompabilityVersions = gradleLines.any((String line) => - line.contains('sourceCompatibility') && !_isCommented(line)) && + line.contains('sourceCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && !_isCommented(line)) && // Newer toolchains default targetCompatibility to the same value as // sourceCompatibility, but older toolchains require it to be set // explicitly. The exact version cutoff (and of which piece of the // toolchain; likely AGP) is unknown; for context see // https://github.com/flutter/flutter/issues/125482 gradleLines.any((String line) => - line.contains('targetCompatibility') && !_isCommented(line)); + line.contains('targetCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && !_isCommented(line)); if (!hasLanguageVersion && !hasCompabilityVersions) { - const String errorMessage = ''' -build.gradle must set an explicit Java compatibility version. + const String javaErrorMessage = ''' +build.gradle(.kts) must set an explicit Java compatibility version. This can be done either via "sourceCompatibility"/"targetCompatibility": android { compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_$requiredJavaVersion + targetCompatibility = JavaVersion.VERSION_$requiredJavaVersion } } or "toolchain": java { toolchain { - languageVersion = JavaLanguageVersion.of(11) + languageVersion = JavaLanguageVersion.of($requiredJavaVersion) } } @@ -389,9 +392,38 @@ https://docs.gradle.org/current/userguide/java_plugin.html#toolchain_and_compati for more details.'''; printError( - '$indentation${errorMessage.split('\n').join('\n$indentation')}'); + '$indentation${javaErrorMessage.split('\n').join('\n$indentation')}'); + return false; + } + bool isKotlinOptions(String line) => line.contains('kotlinOptions') && !_isCommented(line); + final bool hasKotlinOptions = gradleLines.any(isKotlinOptions); + final bool kotlinOptionsUsesJavaVersion = gradleLines.any((String line) => + line.contains('jvmTarget = JavaVersion.VERSION_$requiredJavaVersion') && + !_isCommented(line)); + // Either does not set kotlinOptions or does and uses non-string based syntax. + if (hasKotlinOptions && !kotlinOptionsUsesJavaVersion) { + // Bad lines contains the first 4 lines including the kotlinOptions section. + String badLines = ''; + final int startIndex = gradleLines.indexOf(gradleLines.firstWhere(isKotlinOptions)); + for(int i = startIndex; i < math.min(startIndex + 4, gradleLines.length); i++) { + badLines += '${gradleLines[i]}\n'; + } + final String kotlinErrorMessage = ''' +If build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax. + Good: + android { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_$requiredJavaVersion.toString() + } + } + BAD: + $badLines +'''; + printError( + '$indentation${kotlinErrorMessage.split('\n').join('\n$indentation')}'); return false; } + return true; } diff --git a/script/tool/test/gradle_check_command_test.dart b/script/tool/test/gradle_check_command_test.dart index b442ae8356b..865f37ffdfc 100644 --- a/script/tool/test/gradle_check_command_test.dart +++ b/script/tool/test/gradle_check_command_test.dart @@ -17,6 +17,8 @@ const String _defaultFakeNamespace = 'dev.flutter.foo'; void main() { late CommandRunner runner; late Directory packagesDir; + const String javaIncompatabilityIndicator = + 'build.gradle(.kts) must set an explicit Java compatibility version.'; setUp(() { final GitDir gitDir; @@ -46,6 +48,9 @@ void main() { bool useDeprecatedCompileSdkVersion = false, bool usePropertyAssignment = true, String compileSdk = '36', + bool includeKotlinOptions = true, + bool commentKotlinOptions = false, + bool useDeprecatedJvmTarget = false, }) { final File buildGradle = package .platformDirectory(FlutterPlatform.android) @@ -69,11 +74,17 @@ java { '''; final String sourceCompat = - '${commentSourceLanguage ? '// ' : ''}sourceCompatibility = JavaVersion.VERSION_11'; + '${commentSourceLanguage ? '// ' : ''}sourceCompatibility = JavaVersion.VERSION_17'; final String targetCompat = - '${commentSourceLanguage ? '// ' : ''}targetCompatibility = JavaVersion.VERSION_11'; + '${commentSourceLanguage ? '// ' : ''}targetCompatibility = JavaVersion.VERSION_17'; final String namespace = " ${commentNamespace ? '// ' : ''}namespace = '$_defaultFakeNamespace'"; + final String jvmTarget = + useDeprecatedJvmTarget ? '17' : 'JavaVersion.VERSION_17.toString()'; + final String kotlinConfig = ''' + ${commentKotlinOptions ? '//' : ''}kotlinOptions { + ${commentKotlinOptions ? '//' : ''}jvmTarget = $jvmTarget + ${commentKotlinOptions ? '//' : ''}}'''; buildGradle.writeAsStringSync(''' group 'dev.flutter.plugins.fake' @@ -101,6 +112,7 @@ ${warningsConfigured ? warningConfig : ''} ${includeSourceCompat ? sourceCompat : ''} ${includeTargetCompat ? targetCompat : ''} } + ${includeKotlinOptions ? kotlinConfig : ''} testOptions { unitTests.includeAndroidResources = true } @@ -351,8 +363,7 @@ dependencies { expect( output, containsAllInOrder([ - contains( - 'build.gradle must set an explicit Java compatibility version.'), + contains(javaIncompatabilityIndicator), ]), ); }); @@ -375,8 +386,7 @@ dependencies { expect( output, containsAllInOrder([ - contains( - 'build.gradle must set an explicit Java compatibility version.'), + contains(javaIncompatabilityIndicator), ]), ); }); @@ -457,8 +467,7 @@ dependencies { expect( output, containsAllInOrder([ - contains( - 'build.gradle must set an explicit Java compatibility version.'), + contains(javaIncompatabilityIndicator), ]), ); }); @@ -480,8 +489,7 @@ dependencies { expect( output, containsAllInOrder([ - contains( - 'build.gradle must set an explicit Java compatibility version.'), + contains(javaIncompatabilityIndicator), ]), ); }); @@ -1162,4 +1170,96 @@ dependencies { ); }); }); + + group('kotlinOptions check', () { + test('passes when kotlin options are specified', () async { + final RepositoryPackage package = + createFakePlugin('a_plugin', packagesDir, examples: []); + writeFakePluginBuildGradle( + package, + includeLanguageVersion: true, + // ignore: avoid_redundant_argument_values ensure codepath is tested if defaults change. + includeKotlinOptions: true, + ); + writeFakeManifest(package); + + final List output = + await runCapturingPrint(runner, ['gradle-check']); + + expect( + output, + containsAllInOrder([ + contains('Validating android/build.gradle'), + ]), + ); + }); + + test('passes when kotlin options are not specified', () async { + final RepositoryPackage package = + createFakePlugin('a_plugin', packagesDir, examples: []); + writeFakePluginBuildGradle( + package, + includeLanguageVersion: true, + includeKotlinOptions: false, + ); + writeFakeManifest(package); + + final List output = + await runCapturingPrint(runner, ['gradle-check']); + + expect( + output, + containsAllInOrder([ + contains('Validating android/build.gradle'), + ]), + ); + }); + + test('passes when kotlin options commented out', () async { + final RepositoryPackage package = + createFakePlugin('a_plugin', packagesDir, examples: []); + writeFakePluginBuildGradle( + package, + includeLanguageVersion: true, + commentKotlinOptions: true, + ); + writeFakeManifest(package); + + final List output = + await runCapturingPrint(runner, ['gradle-check']); + + expect( + output, + containsAllInOrder([ + contains('Validating android/build.gradle'), + ]), + ); + }); + + test('fails when kotlin options uses string jvm version', () async { + final RepositoryPackage package = + createFakePlugin('a_plugin', packagesDir, examples: []); + writeFakePluginBuildGradle( + package, + includeLanguageVersion: true, + useDeprecatedJvmTarget: true, + ); + writeFakeManifest(package); + + Error? commandError; + final List output = await runCapturingPrint( + runner, ['gradle-check'], errorHandler: (Error e) { + commandError = e; + }); + + expect(commandError, isA()); + expect( + output, + containsAllInOrder([ + contains( + 'build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax'), + ]), + ); + }); + }); } From d2069f084fb2d8b74fa96c7b2f5cf04d0b082dfa Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 13:19:16 -0400 Subject: [PATCH 02/14] Update interactive_media_ads and camera_android --- packages/camera/camera_android/android/build.gradle | 4 ++-- packages/interactive_media_ads/android/build.gradle | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/camera/camera_android/android/build.gradle b/packages/camera/camera_android/android/build.gradle index fc5cef29083..3f521d2c800 100644 --- a/packages/camera/camera_android/android/build.gradle +++ b/packages/camera/camera_android/android/build.gradle @@ -43,8 +43,8 @@ buildFeatures { disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency', 'NewerVersionAvailable' } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } testOptions { diff --git a/packages/interactive_media_ads/android/build.gradle b/packages/interactive_media_ads/android/build.gradle index 80304caa837..21b3094ba16 100644 --- a/packages/interactive_media_ads/android/build.gradle +++ b/packages/interactive_media_ads/android/build.gradle @@ -30,12 +30,12 @@ android { compileSdk = flutter.compileSdkVersion compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = JavaVersion.VERSION_17.toString() } sourceSets { From 164f7b260611ce56203a1524ee682ee152bf28e1 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 14:14:10 -0400 Subject: [PATCH 03/14] Update compileOptions to java 17 --- packages/camera/camera_android_camerax/android/build.gradle | 6 +++--- .../flutter_plugin_android_lifecycle/android/build.gradle | 4 ++-- .../google_maps_flutter_android/android/build.gradle | 4 ++-- .../google_sign_in_android/android/build.gradle | 6 +++--- .../image_picker/image_picker_android/android/build.gradle | 4 ++-- .../in_app_purchase_android/android/build.gradle | 4 ++-- packages/local_auth/local_auth_android/android/build.gradle | 4 ++-- .../path_provider_android/android/build.gradle | 4 ++-- .../alternate_language_test_plugin/android/build.gradle | 4 ++-- .../pigeon/platform_tests/test_plugin/android/build.gradle | 4 ++-- .../video_player/video_player_android/android/build.gradle | 4 ++-- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/build.gradle b/packages/camera/camera_android_camerax/android/build.gradle index 2194285e5c9..9cf212db7e6 100644 --- a/packages/camera/camera_android_camerax/android/build.gradle +++ b/packages/camera/camera_android_camerax/android/build.gradle @@ -30,13 +30,13 @@ android { compileSdk = flutter.compileSdkVersion compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { // This must match the Java version provided in compileOptions. - jvmTarget = '11' + jvmTarget = JavaVersion.VERSION_17.toString() } defaultConfig { diff --git a/packages/flutter_plugin_android_lifecycle/android/build.gradle b/packages/flutter_plugin_android_lifecycle/android/build.gradle index 4aba6aa739f..753301bc516 100644 --- a/packages/flutter_plugin_android_lifecycle/android/build.gradle +++ b/packages/flutter_plugin_android_lifecycle/android/build.gradle @@ -32,8 +32,8 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } lintOptions { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle index 01d22eb02cf..e280be37488 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle @@ -49,8 +49,8 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } testOptions { diff --git a/packages/google_sign_in/google_sign_in_android/android/build.gradle b/packages/google_sign_in/google_sign_in_android/android/build.gradle index 2b29433ce5d..7d7943cdce6 100644 --- a/packages/google_sign_in/google_sign_in_android/android/build.gradle +++ b/packages/google_sign_in/google_sign_in_android/android/build.gradle @@ -34,12 +34,12 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = JavaVersion.VERSION_17.toString() } sourceSets { diff --git a/packages/image_picker/image_picker_android/android/build.gradle b/packages/image_picker/image_picker_android/android/build.gradle index d2cfc910ce1..8ee553f3d67 100644 --- a/packages/image_picker/image_picker_android/android/build.gradle +++ b/packages/image_picker/image_picker_android/android/build.gradle @@ -47,8 +47,8 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } testOptions { diff --git a/packages/in_app_purchase/in_app_purchase_android/android/build.gradle b/packages/in_app_purchase/in_app_purchase_android/android/build.gradle index ef2a8e11281..2d5d9de95da 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/build.gradle +++ b/packages/in_app_purchase/in_app_purchase_android/android/build.gradle @@ -40,8 +40,8 @@ android { disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency', 'NewerVersionAvailable' } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } diff --git a/packages/local_auth/local_auth_android/android/build.gradle b/packages/local_auth/local_auth_android/android/build.gradle index 637744fc53e..780cf22b94a 100644 --- a/packages/local_auth/local_auth_android/android/build.gradle +++ b/packages/local_auth/local_auth_android/android/build.gradle @@ -31,8 +31,8 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } lintOptions { diff --git a/packages/path_provider/path_provider_android/android/build.gradle b/packages/path_provider/path_provider_android/android/build.gradle index 738db7eaa68..b8d75d65f3c 100644 --- a/packages/path_provider/path_provider_android/android/build.gradle +++ b/packages/path_provider/path_provider_android/android/build.gradle @@ -35,8 +35,8 @@ android { disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency', 'NewerVersionAvailable' } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle index 780d1bc139a..2da1e3bc835 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/android/build.gradle @@ -26,8 +26,8 @@ android { compileSdk = flutter.compileSdkVersion compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } defaultConfig { diff --git a/packages/pigeon/platform_tests/test_plugin/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/android/build.gradle index 9933786c0de..94182ce5d5f 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/test_plugin/android/build.gradle @@ -29,8 +29,8 @@ android { compileSdk = flutter.compileSdkVersion compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_1 } kotlinOptions { diff --git a/packages/video_player/video_player_android/android/build.gradle b/packages/video_player/video_player_android/android/build.gradle index c90d8619027..4ce0516f0e6 100644 --- a/packages/video_player/video_player_android/android/build.gradle +++ b/packages/video_player/video_player_android/android/build.gradle @@ -35,8 +35,8 @@ android { disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency', 'NewerVersionAvailable' } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies { From fd45002995d7c5b642c63757958a7c97afa62375 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 14:25:46 -0400 Subject: [PATCH 04/14] Update changelog and pubspec for modified packages --- packages/camera/camera_android_camerax/CHANGELOG.md | 4 ++++ packages/camera/camera_android_camerax/example/pubspec.yaml | 4 ++-- packages/camera/camera_android_camerax/pubspec.yaml | 6 +++--- packages/flutter_plugin_android_lifecycle/CHANGELOG.md | 4 ++++ .../flutter_plugin_android_lifecycle/example/pubspec.yaml | 4 ++-- packages/flutter_plugin_android_lifecycle/pubspec.yaml | 6 +++--- .../google_maps_flutter_android/CHANGELOG.md | 4 ++++ .../google_maps_flutter_android/example/pubspec.yaml | 4 ++-- .../google_maps_flutter_android/pubspec.yaml | 6 +++--- packages/google_sign_in/google_sign_in_android/CHANGELOG.md | 4 ++++ .../google_sign_in_android/example/pubspec.yaml | 4 ++-- packages/google_sign_in/google_sign_in_android/pubspec.yaml | 6 +++--- packages/image_picker/image_picker_android/CHANGELOG.md | 4 ++++ packages/image_picker/image_picker_android/pubspec.yaml | 2 +- .../in_app_purchase/in_app_purchase_android/CHANGELOG.md | 4 ++++ .../in_app_purchase_android/example/pubspec.yaml | 4 ++-- .../in_app_purchase/in_app_purchase_android/pubspec.yaml | 6 +++--- packages/local_auth/local_auth_android/CHANGELOG.md | 4 ++++ packages/local_auth/local_auth_android/pubspec.yaml | 2 +- packages/path_provider/path_provider_android/CHANGELOG.md | 4 ++++ .../path_provider_android/example/pubspec.yaml | 4 ++-- packages/path_provider/path_provider_android/pubspec.yaml | 6 +++--- packages/pigeon/example/app/pubspec.yaml | 2 +- .../alternate_language_test_plugin/example/pubspec.yaml | 2 +- .../alternate_language_test_plugin/pubspec.yaml | 4 ++-- .../platform_tests/shared_test_plugin_code/pubspec.yaml | 4 ++-- .../pigeon/platform_tests/test_plugin/example/pubspec.yaml | 2 +- packages/pigeon/platform_tests/test_plugin/pubspec.yaml | 4 ++-- packages/pigeon/pubspec.yaml | 2 +- packages/video_player/video_player_android/CHANGELOG.md | 4 ++++ .../video_player/video_player_android/example/pubspec.yaml | 4 ++-- packages/video_player/video_player_android/pubspec.yaml | 6 +++--- 32 files changed, 83 insertions(+), 47 deletions(-) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index 1238546ab25..f65dbe9397f 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.23+2 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 0.6.23+1 * Resolves Gradle 9 deprecations. diff --git a/packages/camera/camera_android_camerax/example/pubspec.yaml b/packages/camera/camera_android_camerax/example/pubspec.yaml index f5238212492..81a4e079b2a 100644 --- a/packages/camera/camera_android_camerax/example/pubspec.yaml +++ b/packages/camera/camera_android_camerax/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the camera_android_camerax plugin. publish_to: 'none' environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: camera_android_camerax: diff --git a/packages/camera/camera_android_camerax/pubspec.yaml b/packages/camera/camera_android_camerax/pubspec.yaml index ae49a1f64ce..8ca7fa6cdd6 100644 --- a/packages/camera/camera_android_camerax/pubspec.yaml +++ b/packages/camera/camera_android_camerax/pubspec.yaml @@ -2,11 +2,11 @@ name: camera_android_camerax description: Android implementation of the camera plugin using the CameraX library. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.6.23+1 +version: 0.6.23+2 environment: - sdk: ^3.8.1 - flutter: ">=3.32.8" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: diff --git a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md index f6f1bd3137e..db8dfa7dd1f 100644 --- a/packages/flutter_plugin_android_lifecycle/CHANGELOG.md +++ b/packages/flutter_plugin_android_lifecycle/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.32 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 2.0.31 * Resolves Gradle 9 deprecations. diff --git a/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml b/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml index bf925f75018..bfeb272f2a7 100644 --- a/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml +++ b/packages/flutter_plugin_android_lifecycle/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the flutter_plugin_android_lifecycle plugin publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: flutter: diff --git a/packages/flutter_plugin_android_lifecycle/pubspec.yaml b/packages/flutter_plugin_android_lifecycle/pubspec.yaml index 6709fa62b2c..2bca90d6830 100644 --- a/packages/flutter_plugin_android_lifecycle/pubspec.yaml +++ b/packages/flutter_plugin_android_lifecycle/pubspec.yaml @@ -2,11 +2,11 @@ name: flutter_plugin_android_lifecycle description: Flutter plugin for accessing an Android Lifecycle within other plugins. repository: https://github.com/flutter/packages/tree/main/packages/flutter_plugin_android_lifecycle issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_plugin_android_lifecycle%22 -version: 2.0.31 +version: 2.0.32 environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: 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 8170f204257..5215e7a577d 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,7 @@ +## 2.18.4 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 2.18.3 * Resolves Gradle 9 deprecations. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml index 11f5f9cf7fe..e556fa6acf9 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the google_maps_flutter plugin. publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: cupertino_icons: ^1.0.5 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 71674fc222e..982c86fb901 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,11 +2,11 @@ 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.18.3 +version: 2.18.4 environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: diff --git a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md index e84adc36e00..dae118d3f2f 100644 --- a/packages/google_sign_in/google_sign_in_android/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 7.2.2 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 7.2.1 * Resolves Gradle 9 deprecations. diff --git a/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml index 65ac709b16d..daa8a3537db 100644 --- a/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Example of Google Sign-In plugin. publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: flutter: diff --git a/packages/google_sign_in/google_sign_in_android/pubspec.yaml b/packages/google_sign_in/google_sign_in_android/pubspec.yaml index 72c093afa05..b865921a203 100644 --- a/packages/google_sign_in/google_sign_in_android/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_android/pubspec.yaml @@ -2,11 +2,11 @@ name: google_sign_in_android description: Android implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 7.2.1 +version: 7.2.2 environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: diff --git a/packages/image_picker/image_picker_android/CHANGELOG.md b/packages/image_picker/image_picker_android/CHANGELOG.md index 96a7b7d3d47..ca92f48f27d 100644 --- a/packages/image_picker/image_picker_android/CHANGELOG.md +++ b/packages/image_picker/image_picker_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.13+5 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 0.8.13+4 * Resolves Gradle 9 deprecations. diff --git a/packages/image_picker/image_picker_android/pubspec.yaml b/packages/image_picker/image_picker_android/pubspec.yaml index 8aee712c688..4014bcd5d42 100755 --- a/packages/image_picker/image_picker_android/pubspec.yaml +++ b/packages/image_picker/image_picker_android/pubspec.yaml @@ -2,7 +2,7 @@ name: image_picker_android description: Android implementation of the image_picker plugin. repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 -version: 0.8.13+4 +version: 0.8.13+5 environment: sdk: ^3.9.0 diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index 971bfb2dfba..6c3f2e7ed3a 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.0+6 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 0.4.0+5 * Resolves Gradle 9 deprecations. diff --git a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml index 1c803ec27da..fd0013c822a 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the in_app_purchase_android plugin. publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: flutter: diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index 0787e32a99a..da0f1f2cd15 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -3,11 +3,11 @@ description: An implementation for the Android platform of the Flutter `in_app_p repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.4.0+5 +version: 0.4.0+6 environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: diff --git a/packages/local_auth/local_auth_android/CHANGELOG.md b/packages/local_auth/local_auth_android/CHANGELOG.md index 1fd8cd26cb1..b2ab3d3363e 100644 --- a/packages/local_auth/local_auth_android/CHANGELOG.md +++ b/packages/local_auth/local_auth_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.56 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 1.0.55 * Resolves Gradle 9 deprecations. diff --git a/packages/local_auth/local_auth_android/pubspec.yaml b/packages/local_auth/local_auth_android/pubspec.yaml index 9792cd775af..651cf4d61bb 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: 1.0.55 +version: 1.0.56 environment: sdk: ^3.9.0 diff --git a/packages/path_provider/path_provider_android/CHANGELOG.md b/packages/path_provider/path_provider_android/CHANGELOG.md index a059d84126a..5c4febf9e00 100644 --- a/packages/path_provider/path_provider_android/CHANGELOG.md +++ b/packages/path_provider/path_provider_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.2.20 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 2.2.19 * Resolves Gradle 9 deprecations. diff --git a/packages/path_provider/path_provider_android/example/pubspec.yaml b/packages/path_provider/path_provider_android/example/pubspec.yaml index 686559935fc..f35ec6388dd 100644 --- a/packages/path_provider/path_provider_android/example/pubspec.yaml +++ b/packages/path_provider/path_provider_android/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the path_provider plugin. publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: flutter: diff --git a/packages/path_provider/path_provider_android/pubspec.yaml b/packages/path_provider/path_provider_android/pubspec.yaml index 26518bb636f..2048cee2dbc 100644 --- a/packages/path_provider/path_provider_android/pubspec.yaml +++ b/packages/path_provider/path_provider_android/pubspec.yaml @@ -2,11 +2,11 @@ name: path_provider_android description: Android implementation of the path_provider plugin. repository: https://github.com/flutter/packages/tree/main/packages/path_provider/path_provider_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22 -version: 2.2.19 +version: 2.2.20 environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: diff --git a/packages/pigeon/example/app/pubspec.yaml b/packages/pigeon/example/app/pubspec.yaml index 8fbb73e09e3..8e2043aaf35 100644 --- a/packages/pigeon/example/app/pubspec.yaml +++ b/packages/pigeon/example/app/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: 'none' version: 1.0.0 environment: - sdk: ^3.7.0 + sdk: ^3.9.0 dependencies: flutter: diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/pubspec.yaml b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/pubspec.yaml index a902a642fd8..32c685284ff 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/pubspec.yaml +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Pigeon test harness for alternate plugin languages. publish_to: 'none' environment: - sdk: ^3.7.0 + sdk: ^3.9.0 dependencies: alternate_language_test_plugin: diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml b/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml index 06058dd0028..bf12dbebf17 100644 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.0.1 publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: diff --git a/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml b/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml index 234f018c1dc..995b01de0f5 100644 --- a/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml +++ b/packages/pigeon/platform_tests/shared_test_plugin_code/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.0.1 publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: build_runner: ^2.1.10 diff --git a/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml b/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml index e63f596204d..96edc8061b7 100644 --- a/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml +++ b/packages/pigeon/platform_tests/test_plugin/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Pigeon test harness for primary plugin languages. publish_to: 'none' environment: - sdk: ^3.7.0 + sdk: ^3.9.0 dependencies: flutter: diff --git a/packages/pigeon/platform_tests/test_plugin/pubspec.yaml b/packages/pigeon/platform_tests/test_plugin/pubspec.yaml index 13121627204..1c32f7b749b 100644 --- a/packages/pigeon/platform_tests/test_plugin/pubspec.yaml +++ b/packages/pigeon/platform_tests/test_plugin/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.0.1 publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 3197a83dd4e..603edb54190 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -5,7 +5,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 26.0.1 # This must match the version in lib/src/generator_tools.dart environment: - sdk: ^3.7.0 + sdk: ^3.9.0 dependencies: analyzer: ">=6.0.0 <8.0.0" diff --git a/packages/video_player/video_player_android/CHANGELOG.md b/packages/video_player/video_player_android/CHANGELOG.md index 74199aa72d8..787c115036d 100644 --- a/packages/video_player/video_player_android/CHANGELOG.md +++ b/packages/video_player/video_player_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.8.16 + +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. + ## 2.8.15 * Resolves Gradle 9 deprecations. diff --git a/packages/video_player/video_player_android/example/pubspec.yaml b/packages/video_player/video_player_android/example/pubspec.yaml index 286f6b89e69..4afc63d4990 100644 --- a/packages/video_player/video_player_android/example/pubspec.yaml +++ b/packages/video_player/video_player_android/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the video_player plugin. publish_to: none environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: flutter: diff --git a/packages/video_player/video_player_android/pubspec.yaml b/packages/video_player/video_player_android/pubspec.yaml index 63639697eed..641a1ff8927 100644 --- a/packages/video_player/video_player_android/pubspec.yaml +++ b/packages/video_player/video_player_android/pubspec.yaml @@ -2,11 +2,11 @@ name: video_player_android description: Android implementation of the video_player plugin. repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22 -version: 2.8.15 +version: 2.8.16 environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: From 44c074eef13509f25f0bd187851bcd453a97ba8c Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 14:28:01 -0400 Subject: [PATCH 05/14] Fix pigeon example --- .../pigeon/platform_tests/test_plugin/android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/pigeon/platform_tests/test_plugin/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/android/build.gradle index 94182ce5d5f..90231752191 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/build.gradle +++ b/packages/pigeon/platform_tests/test_plugin/android/build.gradle @@ -30,11 +30,11 @@ android { compileOptions { sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_1 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = JavaVersion.VERSION_17.toString() allWarningsAsErrors = true } From 5ec1943bc48e53ea17524c16b98beafa6e10997f Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 15:15:18 -0400 Subject: [PATCH 06/14] Update changelog and pubspec for versions that did not need flutter or dart updates --- packages/camera/camera_android/CHANGELOG.md | 4 ++++ packages/camera/camera_android/pubspec.yaml | 2 +- packages/interactive_media_ads/CHANGELOG.md | 4 ++++ .../packages/interactive_media_ads/AdsRequestProxyApi.kt | 2 +- .../interactive_media_ads/AdsRequestProxyAPIDelegate.swift | 2 +- packages/interactive_media_ads/pubspec.yaml | 2 +- packages/pigeon/pubspec.yaml | 2 +- 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/camera/camera_android/CHANGELOG.md b/packages/camera/camera_android/CHANGELOG.md index 3ee1c9e3ab5..cba3c3d32be 100644 --- a/packages/camera/camera_android/CHANGELOG.md +++ b/packages/camera/camera_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.10.10+10 + +* Updates Java compatibility version to 17. + ## 0.10.10+9 * Resolves Gradle 9 deprecations. diff --git a/packages/camera/camera_android/pubspec.yaml b/packages/camera/camera_android/pubspec.yaml index 3ef89354afb..92132de5964 100644 --- a/packages/camera/camera_android/pubspec.yaml +++ b/packages/camera/camera_android/pubspec.yaml @@ -3,7 +3,7 @@ description: Android implementation of the camera plugin. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.10.10+9 +version: 0.10.10+10 environment: sdk: ^3.9.0 diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index 648518c6522..24bed670fa0 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.8+2 + +* Updates Java compatibility version to 17. + ## 0.2.8+1 * Resolves Gradle 9 deprecations. diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt index 6967af134a4..87b05f66f0c 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt @@ -21,7 +21,7 @@ class AdsRequestProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : * * This must match the version in pubspec.yaml. */ - const val pluginVersion = "0.2.8+1" + const val pluginVersion = "0.2.8+2" } override fun setAdTagUrl(pigeon_instance: AdsRequest, adTagUrl: String) { diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift index aa0ed1cf0c9..5735040cedc 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift @@ -13,7 +13,7 @@ class AdsRequestProxyAPIDelegate: PigeonApiDelegateIMAAdsRequest { /// The current version of the `interactive_media_ads` plugin. /// /// This must match the version in pubspec.yaml. - static let pluginVersion = "0.2.8+1" + static let pluginVersion = "0.2.8+2" func pigeonDefaultConstructor( pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index d63ac4db0ae..65070fb1ec4 100644 --- a/packages/interactive_media_ads/pubspec.yaml +++ b/packages/interactive_media_ads/pubspec.yaml @@ -2,7 +2,7 @@ name: interactive_media_ads description: A Flutter plugin for using the Interactive Media Ads SDKs on Android and iOS. repository: https://github.com/flutter/packages/tree/main/packages/interactive_media_ads issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+interactive_media_ads%22 -version: 0.2.8+1 # This must match the version in +version: 0.2.8+2 # This must match the version in # `android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt` and # `ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift` diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 603edb54190..3197a83dd4e 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -5,7 +5,7 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 26.0.1 # This must match the version in lib/src/generator_tools.dart environment: - sdk: ^3.9.0 + sdk: ^3.7.0 dependencies: analyzer: ">=6.0.0 <8.0.0" From a36655585ea1a5a9825c347042b109ada257b548 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 15:36:36 -0400 Subject: [PATCH 07/14] Format packages that were updated with new dart version --- .../integration_test/integration_test.dart | 13 +- .../example/lib/camera_controller.dart | 21 +- .../example/lib/camera_preview.dart | 39 ++- .../example/lib/main.dart | 264 ++++++++---------- .../integration_test/google_maps_test.dart | 60 ++-- .../example/lib/animate_camera.dart | 7 +- .../example/lib/clustering.dart | 46 ++- .../example/lib/ground_overlay.dart | 65 +++-- .../example/lib/main.dart | 18 +- .../example/lib/map_ui.dart | 19 +- .../example/lib/marker_icons.dart | 52 ++-- .../example/lib/place_circle.dart | 35 +-- .../example/lib/place_marker.dart | 88 +++--- .../example/lib/place_polygon.dart | 64 ++--- .../example/lib/place_polyline.dart | 63 ++--- .../example/lib/scrolling_map.dart | 2 +- .../example/lib/snapshot.dart | 4 +- .../lib/src/google_map_inspector_android.dart | 10 +- .../lib/src/google_maps_flutter_android.dart | 176 ++++++------ .../lib/src/messages.g.dart | 37 +-- .../lib/src/serialization.dart | 9 +- .../example/lib/main.dart | 24 +- .../lib/google_sign_in_android.dart | 5 +- .../lib/src/messages.g.dart | 5 +- .../example/lib/main.dart | 106 ++++--- .../src/in_app_purchase_android_platform.dart | 178 ++++++------ ...pp_purchase_android_platform_addition.dart | 44 ++- .../lib/src/messages.g.dart | 31 +- .../lib/src/pigeon_converters.dart | 36 +-- .../types/google_play_product_details.dart | 10 +- .../lib/src/types/translator.dart | 13 +- .../billing_client_manager_test.dart | 7 +- .../billing_client_wrapper_test.dart | 24 +- .../billing_client_wrapper_test.mocks.dart | 42 +-- ...rchase_android_platform_addition_test.dart | 12 +- ...in_app_purchase_android_platform_test.dart | 68 ++--- .../test/test_conversion_utils.dart | 24 +- .../path_provider_android/lib/messages.g.dart | 5 +- .../test/messages_test.g.dart | 5 +- .../integration_test/video_player_test.dart | 48 ++-- .../example/lib/main.dart | 33 ++- .../example/lib/mini_controller.dart | 10 +- .../lib/src/messages.g.dart | 14 +- .../lib/src/platform_view_player.dart | 19 +- .../test/android_video_player_test.dart | 154 ++++------ 45 files changed, 945 insertions(+), 1064 deletions(-) diff --git a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart index 904e7491e38..93de4ea42f9 100644 --- a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart +++ b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart @@ -48,8 +48,9 @@ void main() { testWidgets('availableCameras only supports valid back or front cameras', ( WidgetTester tester, ) async { - final List availableCameras = - await CameraPlatform.instance.availableCameras(); + final List availableCameras = await CameraPlatform + .instance + .availableCameras(); for (final CameraDescription cameraDescription in availableCameras) { expect( @@ -63,8 +64,8 @@ void main() { testWidgets('Preview takes expected resolution from preset', ( WidgetTester tester, ) async { - final List cameras = - await CameraPlatform.instance.availableCameras(); + final List cameras = await CameraPlatform.instance + .availableCameras(); if (cameras.isEmpty) { return; } @@ -104,8 +105,8 @@ void main() { testWidgets('Images from streaming have expected resolution from preset', ( WidgetTester tester, ) async { - final List cameras = - await CameraPlatform.instance.availableCameras(); + final List cameras = await CameraPlatform.instance + .availableCameras(); if (cameras.isEmpty) { return; } diff --git a/packages/camera/camera_android_camerax/example/lib/camera_controller.dart b/packages/camera/camera_android_camerax/example/lib/camera_controller.dart index d66f321538e..2974dbe64ee 100644 --- a/packages/camera/camera_android_camerax/example/lib/camera_controller.dart +++ b/packages/camera/camera_android_camerax/example/lib/camera_controller.dart @@ -187,20 +187,17 @@ class CameraValue { exposurePointSupported ?? this.exposurePointSupported, focusPointSupported: focusPointSupported ?? this.focusPointSupported, deviceOrientation: deviceOrientation ?? this.deviceOrientation, - lockedCaptureOrientation: - lockedCaptureOrientation == null - ? this.lockedCaptureOrientation - : lockedCaptureOrientation.orNull, - recordingOrientation: - recordingOrientation == null - ? this.recordingOrientation - : recordingOrientation.orNull, + lockedCaptureOrientation: lockedCaptureOrientation == null + ? this.lockedCaptureOrientation + : lockedCaptureOrientation.orNull, + recordingOrientation: recordingOrientation == null + ? this.recordingOrientation + : recordingOrientation.orNull, isPreviewPaused: isPreviewPaused ?? this.isPreviewPaused, description: description ?? this.description, - previewPauseOrientation: - previewPauseOrientation == null - ? this.previewPauseOrientation - : previewPauseOrientation.orNull, + previewPauseOrientation: previewPauseOrientation == null + ? this.previewPauseOrientation + : previewPauseOrientation.orNull, ); } diff --git a/packages/camera/camera_android_camerax/example/lib/camera_preview.dart b/packages/camera/camera_android_camerax/example/lib/camera_preview.dart index b24c38e0bf5..54d5b43a240 100644 --- a/packages/camera/camera_android_camerax/example/lib/camera_preview.dart +++ b/packages/camera/camera_android_camerax/example/lib/camera_preview.dart @@ -23,24 +23,23 @@ class CameraPreview extends StatelessWidget { Widget build(BuildContext context) { return controller.value.isInitialized ? ValueListenableBuilder( - valueListenable: controller, - builder: (BuildContext context, Object? value, Widget? child) { - return AspectRatio( - aspectRatio: - _isLandscape() - ? controller.value.aspectRatio - : (1 / controller.value.aspectRatio), - child: Stack( - fit: StackFit.expand, - children: [ - _wrapInRotatedBox(child: controller.buildPreview()), - child ?? Container(), - ], - ), - ); - }, - child: child, - ) + valueListenable: controller, + builder: (BuildContext context, Object? value, Widget? child) { + return AspectRatio( + aspectRatio: _isLandscape() + ? controller.value.aspectRatio + : (1 / controller.value.aspectRatio), + child: Stack( + fit: StackFit.expand, + children: [ + _wrapInRotatedBox(child: controller.buildPreview()), + child ?? Container(), + ], + ), + ); + }, + child: child, + ) : Container(); } @@ -73,7 +72,7 @@ class CameraPreview extends StatelessWidget { return controller.value.isRecordingVideo ? controller.value.recordingOrientation! : (controller.value.previewPauseOrientation ?? - controller.value.lockedCaptureOrientation ?? - controller.value.deviceOrientation); + controller.value.lockedCaptureOrientation ?? + controller.value.deviceOrientation); } } diff --git a/packages/camera/camera_android_camerax/example/lib/main.dart b/packages/camera/camera_android_camerax/example/lib/main.dart index 55a689cdeaf..d67f4412ec0 100644 --- a/packages/camera/camera_android_camerax/example/lib/main.dart +++ b/packages/camera/camera_android_camerax/example/lib/main.dart @@ -141,8 +141,8 @@ class _CameraExampleHomeState extends State border: Border.all( color: controller != null && controller!.value.isRecordingVideo - ? Colors.redAccent - : Colors.grey, + ? Colors.redAccent + : Colors.grey, width: 3.0, ), ), @@ -190,9 +190,8 @@ class _CameraExampleHomeState extends State behavior: HitTestBehavior.opaque, onScaleStart: _handleScaleStart, onScaleUpdate: _handleScaleUpdate, - onTapDown: - (TapDownDetails details) => - onViewFinderTap(details, constraints), + onTapDown: (TapDownDetails details) => + onViewFinderTap(details, constraints), ); }, ), @@ -235,28 +234,26 @@ class _CameraExampleHomeState extends State SizedBox( width: 64.0, height: 64.0, - child: - (localVideoController == null) - ? ( - // The captured image on the web contains a network-accessible URL - // pointing to a location within the browser. It may be displayed - // either with Image.network or Image.memory after loading the image - // bytes to memory. - kIsWeb - ? Image.network(imageFile!.path) - : Image.file(File(imageFile!.path))) - : Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.pink), - ), - child: Center( - child: AspectRatio( - aspectRatio: - localVideoController.value.aspectRatio, - child: VideoPlayer(localVideoController), - ), + child: (localVideoController == null) + ? ( + // The captured image on the web contains a network-accessible URL + // pointing to a location within the browser. It may be displayed + // either with Image.network or Image.memory after loading the image + // bytes to memory. + kIsWeb + ? Image.network(imageFile!.path) + : Image.file(File(imageFile!.path))) + : Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.pink), + ), + child: Center( + child: AspectRatio( + aspectRatio: localVideoController.value.aspectRatio, + child: VideoPlayer(localVideoController), ), ), + ), ), ], ), @@ -279,19 +276,21 @@ class _CameraExampleHomeState extends State // The exposure and focus mode are currently not supported on the web. ...!kIsWeb ? [ - IconButton( - icon: const Icon(Icons.exposure), - color: Colors.blue, - onPressed: - controller != null ? onExposureModeButtonPressed : null, - ), - IconButton( - icon: const Icon(Icons.filter_center_focus), - color: Colors.blue, - onPressed: - controller != null ? onFocusModeButtonPressed : null, - ), - ] + IconButton( + icon: const Icon(Icons.exposure), + color: Colors.blue, + onPressed: controller != null + ? onExposureModeButtonPressed + : null, + ), + IconButton( + icon: const Icon(Icons.filter_center_focus), + color: Colors.blue, + onPressed: controller != null + ? onFocusModeButtonPressed + : null, + ), + ] : [], IconButton( icon: Icon(enableAudio ? Icons.volume_up : Icons.volume_mute), @@ -305,10 +304,9 @@ class _CameraExampleHomeState extends State : Icons.screen_rotation, ), color: Colors.blue, - onPressed: - controller != null - ? onCaptureOrientationLockButtonPressed - : null, + onPressed: controller != null + ? onCaptureOrientationLockButtonPressed + : null, ), ], ), @@ -328,47 +326,39 @@ class _CameraExampleHomeState extends State children: [ IconButton( icon: const Icon(Icons.flash_off), - color: - controller?.value.flashMode == FlashMode.off - ? Colors.orange - : Colors.blue, - onPressed: - controller != null - ? () => onSetFlashModeButtonPressed(FlashMode.off) - : null, + color: controller?.value.flashMode == FlashMode.off + ? Colors.orange + : Colors.blue, + onPressed: controller != null + ? () => onSetFlashModeButtonPressed(FlashMode.off) + : null, ), IconButton( icon: const Icon(Icons.flash_auto), - color: - controller?.value.flashMode == FlashMode.auto - ? Colors.orange - : Colors.blue, - onPressed: - controller != null - ? () => onSetFlashModeButtonPressed(FlashMode.auto) - : null, + color: controller?.value.flashMode == FlashMode.auto + ? Colors.orange + : Colors.blue, + onPressed: controller != null + ? () => onSetFlashModeButtonPressed(FlashMode.auto) + : null, ), IconButton( icon: const Icon(Icons.flash_on), - color: - controller?.value.flashMode == FlashMode.always - ? Colors.orange - : Colors.blue, - onPressed: - controller != null - ? () => onSetFlashModeButtonPressed(FlashMode.always) - : null, + color: controller?.value.flashMode == FlashMode.always + ? Colors.orange + : Colors.blue, + onPressed: controller != null + ? () => onSetFlashModeButtonPressed(FlashMode.always) + : null, ), IconButton( icon: const Icon(Icons.highlight), - color: - controller?.value.flashMode == FlashMode.torch - ? Colors.orange - : Colors.blue, - onPressed: - controller != null - ? () => onSetFlashModeButtonPressed(FlashMode.torch) - : null, + color: controller?.value.flashMode == FlashMode.torch + ? Colors.orange + : Colors.blue, + onPressed: controller != null + ? () => onSetFlashModeButtonPressed(FlashMode.torch) + : null, ), ], ), @@ -378,16 +368,14 @@ class _CameraExampleHomeState extends State Widget _exposureModeControlRowWidget() { final ButtonStyle styleAuto = TextButton.styleFrom( - foregroundColor: - controller?.value.exposureMode == ExposureMode.auto - ? Colors.orange - : Colors.blue, + foregroundColor: controller?.value.exposureMode == ExposureMode.auto + ? Colors.orange + : Colors.blue, ); final ButtonStyle styleLocked = TextButton.styleFrom( - foregroundColor: - controller?.value.exposureMode == ExposureMode.locked - ? Colors.orange - : Colors.blue, + foregroundColor: controller?.value.exposureMode == ExposureMode.locked + ? Colors.orange + : Colors.blue, ); return SizeTransition( @@ -403,12 +391,10 @@ class _CameraExampleHomeState extends State children: [ TextButton( style: styleAuto, - onPressed: - controller != null - ? () => onSetExposureModeButtonPressed( - ExposureMode.auto, - ) - : null, + onPressed: controller != null + ? () => + onSetExposureModeButtonPressed(ExposureMode.auto) + : null, onLongPress: () { if (controller != null) { CameraPlatform.instance.setExposurePoint( @@ -422,20 +408,18 @@ class _CameraExampleHomeState extends State ), TextButton( style: styleLocked, - onPressed: - controller != null - ? () => onSetExposureModeButtonPressed( - ExposureMode.locked, - ) - : null, + onPressed: controller != null + ? () => onSetExposureModeButtonPressed( + ExposureMode.locked, + ) + : null, child: const Text('LOCKED'), ), TextButton( style: styleLocked, - onPressed: - controller != null - ? () => controller!.setExposureOffset(0.0) - : null, + onPressed: controller != null + ? () => controller!.setExposureOffset(0.0) + : null, child: const Text('RESET OFFSET'), ), ], @@ -453,9 +437,9 @@ class _CameraExampleHomeState extends State onChanged: (_) {}, onChangeEnd: _minAvailableExposureOffset == - _maxAvailableExposureOffset - ? null - : setExposureOffset, + _maxAvailableExposureOffset + ? null + : setExposureOffset, ), Text(_maxAvailableExposureOffset.toString()), ], @@ -469,16 +453,14 @@ class _CameraExampleHomeState extends State Widget _focusModeControlRowWidget() { final ButtonStyle styleAuto = TextButton.styleFrom( - foregroundColor: - controller?.value.focusMode == FocusMode.auto - ? Colors.orange - : Colors.blue, + foregroundColor: controller?.value.focusMode == FocusMode.auto + ? Colors.orange + : Colors.blue, ); final ButtonStyle styleLocked = TextButton.styleFrom( - foregroundColor: - controller?.value.focusMode == FocusMode.locked - ? Colors.orange - : Colors.blue, + foregroundColor: controller?.value.focusMode == FocusMode.locked + ? Colors.orange + : Colors.blue, ); return SizeTransition( @@ -494,10 +476,9 @@ class _CameraExampleHomeState extends State children: [ TextButton( style: styleAuto, - onPressed: - controller != null - ? () => onSetFocusModeButtonPressed(FocusMode.auto) - : null, + onPressed: controller != null + ? () => onSetFocusModeButtonPressed(FocusMode.auto) + : null, onLongPress: () { if (controller != null) { CameraPlatform.instance.setFocusPoint( @@ -511,11 +492,9 @@ class _CameraExampleHomeState extends State ), TextButton( style: styleLocked, - onPressed: - controller != null - ? () => - onSetFocusModeButtonPressed(FocusMode.locked) - : null, + onPressed: controller != null + ? () => onSetFocusModeButtonPressed(FocusMode.locked) + : null, child: const Text('LOCKED'), ), ], @@ -539,23 +518,24 @@ class _CameraExampleHomeState extends State color: Colors.blue, onPressed: cameraController != null && - cameraController.value.isInitialized && - !cameraController.value.isRecordingVideo - ? onTakePictureButtonPressed - : null, + cameraController.value.isInitialized && + !cameraController.value.isRecordingVideo + ? onTakePictureButtonPressed + : null, ), IconButton( icon: const Icon(Icons.videocam), color: Colors.blue, - onPressed: - cameraController == null ? null : onVideoRecordButtonPressed, + onPressed: cameraController == null + ? null + : onVideoRecordButtonPressed, ), IconButton( icon: cameraController != null && - cameraController.value.isRecordingPaused - ? const Icon(Icons.play_arrow) - : const Icon(Icons.pause), + cameraController.value.isRecordingPaused + ? const Icon(Icons.play_arrow) + : const Icon(Icons.pause), color: Colors.blue, onPressed: () { if (cameraController == null) { @@ -576,10 +556,11 @@ class _CameraExampleHomeState extends State icon: const Icon(Icons.pause_presentation), color: cameraController != null && cameraController.value.isPreviewPaused - ? Colors.red - : Colors.blue, - onPressed: - cameraController == null ? null : onPausePreviewButtonPressed, + ? Colors.red + : Colors.blue, + onPressed: cameraController == null + ? null + : onPausePreviewButtonPressed, ), ], ); @@ -687,13 +668,13 @@ class _CameraExampleHomeState extends State // The exposure mode is currently not supported on the web. ...!kIsWeb ? >[ - cameraController.getMinExposureOffset().then( - (double value) => _minAvailableExposureOffset = value, - ), - cameraController.getMaxExposureOffset().then( - (double value) => _maxAvailableExposureOffset = value, - ), - ] + cameraController.getMinExposureOffset().then( + (double value) => _minAvailableExposureOffset = value, + ), + cameraController.getMaxExposureOffset().then( + (double value) => _maxAvailableExposureOffset = value, + ), + ] : >[], cameraController.getMaxZoomLevel().then( (double value) => _maxAvailableZoom = value, @@ -1012,10 +993,9 @@ class _CameraExampleHomeState extends State return; } - final VideoPlayerController vController = - kIsWeb - ? VideoPlayerController.networkUrl(Uri.parse(videoFile!.path)) - : VideoPlayerController.file(File(videoFile!.path)); + final VideoPlayerController vController = kIsWeb + ? VideoPlayerController.networkUrl(Uri.parse(videoFile!.path)) + : VideoPlayerController.file(File(videoFile!.path)); videoPlayerListener = () { if (videoController != null) { diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart index 456c0e08c9a..d421bcf9718 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart @@ -667,8 +667,8 @@ void main() { ); await tester.pumpAndSettle(const Duration(seconds: 3)); - final LatLngBounds secondVisibleRegion = - await mapController.getVisibleRegion(); + final LatLngBounds secondVisibleRegion = await mapController + .getVisibleRegion(); expect(secondVisibleRegion, isNot(zeroLatLngBounds)); @@ -1219,16 +1219,14 @@ void main() { final GoogleMapsInspectorPlatform inspector = GoogleMapsInspectorPlatform.instance!; - final TileOverlay tileOverlayInfo1 = - (await inspector.getTileOverlayInfo( - tileOverlay1.mapsId, - mapId: mapId, - ))!; - final TileOverlay tileOverlayInfo2 = - (await inspector.getTileOverlayInfo( - tileOverlay2.mapsId, - mapId: mapId, - ))!; + final TileOverlay tileOverlayInfo1 = (await inspector.getTileOverlayInfo( + tileOverlay1.mapsId, + mapId: mapId, + ))!; + final TileOverlay tileOverlayInfo2 = (await inspector.getTileOverlayInfo( + tileOverlay2.mapsId, + mapId: mapId, + ))!; expect(tileOverlayInfo1.visible, isTrue); expect(tileOverlayInfo1.fadeIn, isTrue); @@ -1306,11 +1304,10 @@ void main() { await tester.pumpAndSettle(const Duration(seconds: 3)); - final TileOverlay tileOverlayInfo1 = - (await inspector.getTileOverlayInfo( - tileOverlay1.mapsId, - mapId: mapId, - ))!; + final TileOverlay tileOverlayInfo1 = (await inspector.getTileOverlayInfo( + tileOverlay1.mapsId, + mapId: mapId, + ))!; final TileOverlay? tileOverlayInfo2 = await inspector.getTileOverlayInfo( tileOverlay2.mapsId, mapId: mapId, @@ -1780,18 +1777,12 @@ void main() { GoogleMapsInspectorPlatform.instance!; if (inspector.supportsGettingGroundOverlayInfo()) { - final GroundOverlay groundOverlayBoundsInfo1 = - (await inspector.getGroundOverlayInfo( - groundOverlayBounds1.mapsId, - mapId: mapId, - ))!; - final GroundOverlay groundOverlayBoundsInfo2 = - (await inspector.getGroundOverlayInfo( - groundOverlayBounds2.mapsId, - mapId: mapId, - ))!; - final GroundOverlay groundOverlayPositionInfo1 = - (await inspector.getGroundOverlayInfo( + final GroundOverlay groundOverlayBoundsInfo1 = (await inspector + .getGroundOverlayInfo(groundOverlayBounds1.mapsId, mapId: mapId))!; + final GroundOverlay groundOverlayBoundsInfo2 = (await inspector + .getGroundOverlayInfo(groundOverlayBounds2.mapsId, mapId: mapId))!; + final GroundOverlay groundOverlayPositionInfo1 = (await inspector + .getGroundOverlayInfo( groundOverlayPosition1.mapsId, mapId: mapId, ))!; @@ -1876,13 +1867,10 @@ void main() { await tester.pumpAndSettle(const Duration(seconds: 3)); if (inspector.supportsGettingGroundOverlayInfo()) { - final GroundOverlay groundOverlayBounds1Info = - (await inspector.getGroundOverlayInfo( - groundOverlayBounds1.mapsId, - mapId: mapId, - ))!; - final GroundOverlay groundOverlayPosition1Info = - (await inspector.getGroundOverlayInfo( + final GroundOverlay groundOverlayBounds1Info = (await inspector + .getGroundOverlayInfo(groundOverlayBounds1.mapsId, mapId: mapId))!; + final GroundOverlay groundOverlayPosition1Info = (await inspector + .getGroundOverlayInfo( groundOverlayPosition1.mapsId, mapId: mapId, ))!; 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 95b132fe9e6..a7c515c3692 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 @@ -40,10 +40,9 @@ class AnimateCameraState extends State { void _toggleAnimationDuration() { setState(() { - _cameraUpdateAnimationDuration = - _cameraUpdateAnimationDuration != null - ? null - : const Duration(seconds: _durationSeconds); + _cameraUpdateAnimationDuration = _cameraUpdateAnimationDuration != null + ? null + : const Duration(seconds: _durationSeconds); }); } 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 2a4463c9ca6..ca60d810373 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 @@ -131,10 +131,9 @@ class ClusteringBodyState extends State { final ClusterManager clusterManager = ClusterManager( clusterManagerId: clusterManagerId, - onClusterTap: - (Cluster cluster) => setState(() { - lastCluster = cluster; - }), + onClusterTap: (Cluster cluster) => setState(() { + lastCluster = cluster; + }), ); setState(() { @@ -203,10 +202,9 @@ class ClusteringBodyState extends State { final Marker marker = markers[markerId]!; final double current = marker.alpha; markers[markerId] = marker.copyWith( - alphaParam: - current == _fullyVisibleAlpha - ? _halfVisibleAlpha - : _fullyVisibleAlpha, + alphaParam: current == _fullyVisibleAlpha + ? _halfVisibleAlpha + : _fullyVisibleAlpha, ); } setState(() {}); @@ -231,18 +229,15 @@ class ClusteringBodyState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ TextButton( - onPressed: - clusterManagers.length >= _clusterManagerMaxCount - ? null - : () => _addClusterManager(), + onPressed: clusterManagers.length >= _clusterManagerMaxCount + ? null + : () => _addClusterManager(), child: const Text('Add cluster manager'), ), TextButton( - onPressed: - clusterManagers.isEmpty - ? null - : () => - _removeClusterManager(clusterManagers.values.last), + onPressed: clusterManagers.isEmpty + ? null + : () => _removeClusterManager(clusterManagers.values.last), child: const Text('Remove cluster manager'), ), ], @@ -262,15 +257,14 @@ class ClusteringBodyState extends State { alignment: WrapAlignment.spaceEvenly, children: [ TextButton( - onPressed: - selectedId == null - ? null - : () { - _remove(selectedId); - setState(() { - selectedMarker = null; - }); - }, + onPressed: selectedId == null + ? null + : () { + _remove(selectedId); + setState(() { + selectedMarker = null; + }); + }, child: const Text('Remove selected marker'), ), TextButton( 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 948da41b6ad..33f310de2b2 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 @@ -137,8 +137,9 @@ class GroundOverlayBodyState extends State { // Adjusts the bearing by 10 degrees, wrapping around at 360 degrees. // 10 is the increment, 350 degrees of the full circle -10. _groundOverlay = _groundOverlay!.copyWith( - bearingParam: - _groundOverlay!.bearing >= 350 ? 0 : _groundOverlay!.bearing + 10, + bearingParam: _groundOverlay!.bearing >= 350 + ? 0 + : _groundOverlay!.bearing + 10, ); }); } @@ -146,8 +147,9 @@ class GroundOverlayBodyState extends State { void _changeTransparency() { assert(_groundOverlay != null); setState(() { - final double transparency = - _groundOverlay!.transparency == 0.0 ? 0.5 : 0.0; + final double transparency = _groundOverlay!.transparency == 0.0 + ? 0.5 + : 0.0; _groundOverlay = _groundOverlay!.copyWith( transparencyParam: transparency, ); @@ -158,10 +160,9 @@ class GroundOverlayBodyState extends State { assert(_groundOverlay != null); assert(_placingType == _GroundOverlayPlacing.position); setState(() { - _dimensions = - _dimensions == const Offset(1000, 1000) - ? const Offset(1500, 500) - : const Offset(1000, 1000); + _dimensions = _dimensions == const Offset(1000, 1000) + ? const Offset(1500, 500) + : const Offset(1000, 1000); }); // Re-add the ground overlay to apply the new position, as the position @@ -173,10 +174,9 @@ class GroundOverlayBodyState extends State { assert(_groundOverlay != null); assert(_placingType == _GroundOverlayPlacing.position); setState(() { - _currentGroundOverlayPos = - _currentGroundOverlayPos == _groundOverlayPos1 - ? _groundOverlayPos2 - : _groundOverlayPos1; + _currentGroundOverlayPos = _currentGroundOverlayPos == _groundOverlayPos1 + ? _groundOverlayPos2 + : _groundOverlayPos1; }); // Re-add the ground overlay to apply the new position, as the position @@ -190,8 +190,8 @@ class GroundOverlayBodyState extends State { setState(() { _currentGroundOverlayBounds = _currentGroundOverlayBounds == _groundOverlayBounds1 - ? _groundOverlayBounds2 - : _groundOverlayBounds1; + ? _groundOverlayBounds2 + : _groundOverlayBounds1; }); // Re-add the ground overlay to apply the new position, as the position @@ -219,10 +219,9 @@ class GroundOverlayBodyState extends State { Future _changeType() async { setState(() { - _placingType = - _placingType == _GroundOverlayPlacing.position - ? _GroundOverlayPlacing.bounds - : _GroundOverlayPlacing.position; + _placingType = _placingType == _GroundOverlayPlacing.position + ? _GroundOverlayPlacing.bounds + : _GroundOverlayPlacing.position; }); // Re-add the ground overlay to apply the new position, as the position @@ -233,10 +232,9 @@ class GroundOverlayBodyState extends State { Future _changeAnchor() async { assert(_groundOverlay != null); setState(() { - _anchor = - _groundOverlay!.anchor == const Offset(0.5, 0.5) - ? const Offset(1.0, 1.0) - : const Offset(0.5, 0.5); + _anchor = _groundOverlay!.anchor == const Offset(0.5, 0.5) + ? const Offset(1.0, 1.0) + : const Offset(0.5, 0.5); }); // Re-add the ground overlay to apply the new anchor, as anchor cannot be @@ -281,8 +279,9 @@ class GroundOverlayBodyState extends State { alignment: WrapAlignment.spaceEvenly, children: [ TextButton( - onPressed: - _groundOverlay == null ? null : () => _changeTransparency(), + onPressed: _groundOverlay == null + ? null + : () => _changeTransparency(), child: const Text('change transparency'), ), TextButton( @@ -312,25 +311,25 @@ class GroundOverlayBodyState extends State { TextButton( onPressed: _placingType != _GroundOverlayPlacing.position || - _groundOverlay == null - ? null - : () => _changePosition(), + _groundOverlay == null + ? null + : () => _changePosition(), child: const Text('change position'), ), TextButton( onPressed: _placingType != _GroundOverlayPlacing.position || - _groundOverlay == null - ? null - : () => _changeDimensions(), + _groundOverlay == null + ? null + : () => _changeDimensions(), child: const Text('change dimensions'), ), TextButton( onPressed: _placingType != _GroundOverlayPlacing.bounds || - _groundOverlay == null - ? null - : () => _changeBounds(), + _groundOverlay == null + ? null + : () => _changeBounds(), child: const Text('change bounds'), ), ], diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart index 3b7480328c6..b980e1d2a64 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/main.dart @@ -57,9 +57,10 @@ class MapsDemo extends StatelessWidget { void _pushPage(BuildContext context, GoogleMapExampleAppPage page) { Navigator.of(context).push( MaterialPageRoute( - builder: - (_) => - Scaffold(appBar: AppBar(title: Text(page.title)), body: page), + builder: (_) => Scaffold( + appBar: AppBar(title: Text(page.title)), + body: page, + ), ), ); } @@ -70,12 +71,11 @@ class MapsDemo extends StatelessWidget { appBar: AppBar(title: const Text('GoogleMaps examples')), body: ListView.builder( itemCount: _allPages.length, - itemBuilder: - (_, int index) => ListTile( - leading: _allPages[index].leading, - title: Text(_allPages[index].title), - onTap: () => _pushPage(context, _allPages[index]), - ), + itemBuilder: (_, int index) => ListTile( + leading: _allPages[index].leading, + title: Text(_allPages[index].title), + onTap: () => _pushPage(context, _allPages[index]), + ), ), ); } 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 140f8b7105f..3cad6f0f84e 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 @@ -103,10 +103,9 @@ class MapUiBodyState extends State { ), onPressed: () { setState(() { - _cameraTargetBounds = - _cameraTargetBounds.bounds == null - ? CameraTargetBounds(sydneyBounds) - : CameraTargetBounds.unbounded; + _cameraTargetBounds = _cameraTargetBounds.bounds == null + ? CameraTargetBounds(sydneyBounds) + : CameraTargetBounds.unbounded; }); }, ); @@ -119,10 +118,9 @@ class MapUiBodyState extends State { ), onPressed: () { setState(() { - _minMaxZoomPreference = - _minMaxZoomPreference.minZoom == null - ? const MinMaxZoomPreference(12.0, 16.0) - : MinMaxZoomPreference.unbounded; + _minMaxZoomPreference = _minMaxZoomPreference.minZoom == null + ? const MinMaxZoomPreference(12.0, 16.0) + : MinMaxZoomPreference.unbounded; }); }, ); @@ -255,8 +253,9 @@ class MapUiBodyState extends State { child: Text('${_nightMode ? 'disable' : 'enable'} night mode'), onPressed: () async { _nightMode = !_nightMode; - final String style = - _nightMode ? await _getFileData('assets/night_mode.json') : ''; + final String style = _nightMode + ? await _getFileData('assets/night_mode.json') + : ''; setState(() { _mapStyle = style; }); 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 ccb58231fa1..40df30c94ac 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 @@ -112,15 +112,14 @@ class MarkerIconsBodyState extends State { }); } }, - items: - _MarkerSizeOption.values.map(( - _MarkerSizeOption option, - ) { - return DropdownMenuItem<_MarkerSizeOption>( - value: option, - child: Text(_getMarkerSizeOptionName(option)), - ); - }).toList(), + items: _MarkerSizeOption.values.map(( + _MarkerSizeOption option, + ) { + return DropdownMenuItem<_MarkerSizeOption>( + value: option, + child: Text(_getMarkerSizeOptionName(option)), + ); + }).toList(), ), ], ), @@ -253,10 +252,12 @@ class MarkerIconsBodyState extends State { Future _updateMarkerAssetImage(BuildContext context) async { // Width and height are used only for custom size. - final (double? width, double? height) = - _scalingEnabled && _customSizeEnabled - ? _getCurrentMarkerSize() - : (null, null); + final ( + double? width, + double? height, + ) = _scalingEnabled && _customSizeEnabled + ? _getCurrentMarkerSize() + : (null, null); AssetMapBitmap assetMapBitmap; if (_mipMapsEnabled) { @@ -268,8 +269,9 @@ class MarkerIconsBodyState extends State { 'assets/red_square.png', width: width, height: height, - bitmapScaling: - _scalingEnabled ? MapBitmapScaling.auto : MapBitmapScaling.none, + bitmapScaling: _scalingEnabled + ? MapBitmapScaling.auto + : MapBitmapScaling.none, ); } else { // Uses hardcoded asset path @@ -279,8 +281,9 @@ class MarkerIconsBodyState extends State { 'assets/red_square.png', width: width, height: height, - bitmapScaling: - _scalingEnabled ? MapBitmapScaling.auto : MapBitmapScaling.none, + bitmapScaling: _scalingEnabled + ? MapBitmapScaling.auto + : MapBitmapScaling.none, ); } @@ -304,18 +307,21 @@ class MarkerIconsBodyState extends State { final ByteData bytes = await createCustomMarkerIconImage(size: canvasSize); // Width and height are used only for custom size. - final (double? width, double? height) = - _scalingEnabled && _customSizeEnabled - ? _getCurrentMarkerSize() - : (null, null); + final ( + double? width, + double? height, + ) = _scalingEnabled && _customSizeEnabled + ? _getCurrentMarkerSize() + : (null, null); final BytesMapBitmap bitmap = BytesMapBitmap( bytes.buffer.asUint8List(), imagePixelRatio: imagePixelRatio, width: width, height: height, - bitmapScaling: - _scalingEnabled ? MapBitmapScaling.auto : MapBitmapScaling.none, + bitmapScaling: _scalingEnabled + ? MapBitmapScaling.auto + : MapBitmapScaling.none, ); _updateBytesBitmap(bitmap); 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 b3090032be1..d45ec7e5c27 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 @@ -171,17 +171,15 @@ class PlaceCircleBodyState extends State { children: [ TextButton(onPressed: _add, child: const Text('add')), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _remove(selectedId), + onPressed: (selectedId == null) + ? null + : () => _remove(selectedId), child: const Text('remove'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _toggleVisible(selectedId), + onPressed: (selectedId == null) + ? null + : () => _toggleVisible(selectedId), child: const Text('toggle visible'), ), ], @@ -189,24 +187,21 @@ class PlaceCircleBodyState extends State { Column( children: [ TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeStrokeWidth(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeStrokeWidth(selectedId), child: const Text('change stroke width'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeStrokeColor(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeStrokeColor(selectedId), child: const Text('change stroke color'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeFillColor(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeFillColor(selectedId), child: const Text('change fill color'), ), ], 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 8617ea8fecc..e32b7b27747 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 @@ -287,8 +287,9 @@ class PlaceMarkerBodyState extends State { children: [ TextButton(onPressed: _add, child: const Text('Add')), TextButton( - onPressed: - selectedId == null ? null : () => _remove(selectedId), + onPressed: selectedId == null + ? null + : () => _remove(selectedId), child: const Text('Remove'), ), ], @@ -297,82 +298,73 @@ class PlaceMarkerBodyState extends State { alignment: WrapAlignment.spaceEvenly, children: [ TextButton( - onPressed: - selectedId == null ? null : () => _changeInfo(selectedId), + onPressed: selectedId == null + ? null + : () => _changeInfo(selectedId), child: const Text('change info'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _changeInfoAnchor(selectedId), + onPressed: selectedId == null + ? null + : () => _changeInfoAnchor(selectedId), child: const Text('change info anchor'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _changeAlpha(selectedId), + onPressed: selectedId == null + ? null + : () => _changeAlpha(selectedId), child: const Text('change alpha'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _changeAnchor(selectedId), + onPressed: selectedId == null + ? null + : () => _changeAnchor(selectedId), child: const Text('change anchor'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _toggleDraggable(selectedId), + onPressed: selectedId == null + ? null + : () => _toggleDraggable(selectedId), child: const Text('toggle draggable'), ), TextButton( - onPressed: - selectedId == null ? null : () => _toggleFlat(selectedId), + onPressed: selectedId == null + ? null + : () => _toggleFlat(selectedId), child: const Text('toggle flat'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _changePosition(selectedId), + onPressed: selectedId == null + ? null + : () => _changePosition(selectedId), child: const Text('change position'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _changeRotation(selectedId), + onPressed: selectedId == null + ? null + : () => _changeRotation(selectedId), child: const Text('change rotation'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _toggleVisible(selectedId), + onPressed: selectedId == null + ? null + : () => _toggleVisible(selectedId), child: const Text('toggle visible'), ), TextButton( - onPressed: - selectedId == null - ? null - : () => _changeZIndex(selectedId), + onPressed: selectedId == null + ? null + : () => _changeZIndex(selectedId), child: const Text('change zIndex'), ), TextButton( - onPressed: - selectedId == null - ? null - : () { - _getMarkerIcon(context).then(( - BitmapDescriptor icon, - ) { - _setMarkerIcon(selectedId, icon); - }); - }, + onPressed: selectedId == null + ? null + : () { + _getMarkerIcon(context).then((BitmapDescriptor icon) { + _setMarkerIcon(selectedId, icon); + }); + }, child: const Text('set marker icon'), ), ], 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 1fffc4452f2..79475381c15 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 @@ -194,24 +194,21 @@ class PlacePolygonBodyState extends State { children: [ TextButton(onPressed: _add, child: const Text('add')), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _remove(selectedId), + onPressed: (selectedId == null) + ? null + : () => _remove(selectedId), child: const Text('remove'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _toggleVisible(selectedId), + onPressed: (selectedId == null) + ? null + : () => _toggleVisible(selectedId), child: const Text('toggle visible'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _toggleGeodesic(selectedId), + onPressed: (selectedId == null) + ? null + : () => _toggleGeodesic(selectedId), child: const Text('toggle geodesic'), ), ], @@ -219,42 +216,37 @@ class PlacePolygonBodyState extends State { Column( children: [ TextButton( - onPressed: - (selectedId == null) - ? null - : (polygons[selectedId]!.holes.isNotEmpty - ? null - : () => _addHoles(selectedId)), + onPressed: (selectedId == null) + ? null + : (polygons[selectedId]!.holes.isNotEmpty + ? null + : () => _addHoles(selectedId)), child: const Text('add holes'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : (polygons[selectedId]!.holes.isEmpty - ? null - : () => _removeHoles(selectedId)), + onPressed: (selectedId == null) + ? null + : (polygons[selectedId]!.holes.isEmpty + ? null + : () => _removeHoles(selectedId)), child: const Text('remove holes'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeWidth(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeWidth(selectedId), child: const Text('change stroke width'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeStrokeColor(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeStrokeColor(selectedId), child: const Text('change stroke color'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeFillColor(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeFillColor(selectedId), child: const Text('change fill color'), ), ], 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 2bfacb9c30e..854046b3053 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 @@ -237,24 +237,21 @@ class PlacePolylineBodyState extends State { children: [ TextButton(onPressed: _add, child: const Text('add')), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _remove(selectedId), + onPressed: (selectedId == null) + ? null + : () => _remove(selectedId), child: const Text('remove'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _toggleVisible(selectedId), + onPressed: (selectedId == null) + ? null + : () => _toggleVisible(selectedId), child: const Text('toggle visible'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _toggleGeodesic(selectedId), + onPressed: (selectedId == null) + ? null + : () => _toggleGeodesic(selectedId), child: const Text('toggle geodesic'), ), ], @@ -262,45 +259,39 @@ class PlacePolylineBodyState extends State { Column( children: [ TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeWidth(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeWidth(selectedId), child: const Text('change width'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changeColor(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changeColor(selectedId), child: const Text('change color'), ), TextButton( - onPressed: - isIOS || (selectedId == null) - ? null - : () => _changeStartCap(selectedId), + onPressed: isIOS || (selectedId == null) + ? null + : () => _changeStartCap(selectedId), child: const Text('change start cap [Android only]'), ), TextButton( - onPressed: - isIOS || (selectedId == null) - ? null - : () => _changeEndCap(selectedId), + onPressed: isIOS || (selectedId == null) + ? null + : () => _changeEndCap(selectedId), child: const Text('change end cap [Android only]'), ), TextButton( - onPressed: - isIOS || (selectedId == null) - ? null - : () => _changeJointType(selectedId), + onPressed: isIOS || (selectedId == null) + ? null + : () => _changeJointType(selectedId), child: const Text('change joint type [Android only]'), ), TextButton( - onPressed: - (selectedId == null) - ? null - : () => _changePattern(selectedId), + onPressed: (selectedId == null) + ? null + : () => _changePattern(selectedId), child: const Text('change pattern'), ), ], 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 c1970920175..57d8cd6d9ff 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 @@ -50,7 +50,7 @@ class ScrollingMapBody extends StatelessWidget { zoom: 11.0, ), gestureRecognizers: // - >{ + >{ Factory( () => EagerGestureRecognizer(), ), 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 d003226ac5b..8fa4d67b642 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 @@ -57,8 +57,8 @@ class _SnapshotBodyState extends State<_SnapshotBody> { TextButton( child: const Text('Take a snapshot'), onPressed: () async { - final Uint8List? imageBytes = - await _mapController?.takeSnapshot(); + final Uint8List? imageBytes = await _mapController + ?.takeSnapshot(); setState(() { _imageBytes = imageBytes; }); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart index 4c89d698245..ef0b0aeb351 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_map_inspector_android.dart @@ -53,8 +53,9 @@ class GoogleMapsInspectorAndroid extends GoogleMapsInspectorPlatform { @override Future getMinMaxZoomLevels({required int mapId}) async { - final PlatformZoomRange zoomLevels = - await _inspectorProvider(mapId)!.getZoomRange(); + final PlatformZoomRange zoomLevels = await _inspectorProvider( + mapId, + )!.getZoomRange(); return MinMaxZoomPreference(zoomLevels.min, zoomLevels.max); } @@ -196,8 +197,9 @@ class GoogleMapsInspectorAndroid extends GoogleMapsInspectorPlatform { @override Future getCameraPosition({required int mapId}) async { - final PlatformCameraPosition cameraPosition = - await _inspectorProvider(mapId)!.getCameraPosition(); + final PlatformCameraPosition cameraPosition = await _inspectorProvider( + mapId, + )!.getCameraPosition(); return CameraPosition( target: LatLng( cameraPosition.target.latitude, diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart index 4871b2d3302..34d05ca6f8f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart @@ -329,10 +329,9 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { }) { final Map? currentTileOverlays = _tileOverlays[mapId]; - final Set previousSet = - currentTileOverlays != null - ? currentTileOverlays.values.toSet() - : {}; + final Set previousSet = currentTileOverlays != null + ? currentTileOverlays.values.toSet() + : {}; final _TileOverlayUpdates updates = _TileOverlayUpdates.from( previousSet, newTileOverlays, @@ -572,44 +571,44 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { widgetConfiguration.initialCameraPosition, ), mapConfiguration: mapConfiguration, - initialMarkers: - mapObjects.markers.map(_platformMarkerFromMarker).toList(), - initialPolygons: - mapObjects.polygons.map(_platformPolygonFromPolygon).toList(), - initialPolylines: - mapObjects.polylines.map(_platformPolylineFromPolyline).toList(), - initialCircles: - mapObjects.circles.map(_platformCircleFromCircle).toList(), - initialHeatmaps: - mapObjects.heatmaps.map(_platformHeatmapFromHeatmap).toList(), - initialTileOverlays: - mapObjects.tileOverlays - .map(_platformTileOverlayFromTileOverlay) - .toList(), - initialClusterManagers: - mapObjects.clusterManagers - .map(_platformClusterManagerFromClusterManager) - .toList(), - initialGroundOverlays: - mapObjects.groundOverlays - .map(_platformGroundOverlayFromGroundOverlay) - .toList(), + initialMarkers: mapObjects.markers + .map(_platformMarkerFromMarker) + .toList(), + initialPolygons: mapObjects.polygons + .map(_platformPolygonFromPolygon) + .toList(), + initialPolylines: mapObjects.polylines + .map(_platformPolylineFromPolyline) + .toList(), + initialCircles: mapObjects.circles + .map(_platformCircleFromCircle) + .toList(), + initialHeatmaps: mapObjects.heatmaps + .map(_platformHeatmapFromHeatmap) + .toList(), + initialTileOverlays: mapObjects.tileOverlays + .map(_platformTileOverlayFromTileOverlay) + .toList(), + initialClusterManagers: mapObjects.clusterManagers + .map(_platformClusterManagerFromClusterManager) + .toList(), + initialGroundOverlays: mapObjects.groundOverlays + .map(_platformGroundOverlayFromGroundOverlay) + .toList(), ); const String viewType = 'plugins.flutter.dev/google_maps_android'; if (useAndroidViewSurface) { return PlatformViewLink( viewType: viewType, - surfaceFactory: ( - BuildContext context, - PlatformViewController controller, - ) { - return AndroidViewSurface( - controller: controller as AndroidViewController, - gestureRecognizers: widgetConfiguration.gestureRecognizers, - hitTestBehavior: PlatformViewHitTestBehavior.opaque, - ); - }, + surfaceFactory: + (BuildContext context, PlatformViewController controller) { + return AndroidViewSurface( + controller: controller as AndroidViewController, + gestureRecognizers: widgetConfiguration.gestureRecognizers, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, onCreatePlatformView: (PlatformViewCreationParams params) { final AndroidViewController controller = PlatformViewsService.initExpensiveAndroidView( @@ -834,15 +833,13 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { ) { return PlatformGroundOverlay( groundOverlayId: groundOverlay.groundOverlayId.value, - anchor: - groundOverlay.anchor != null - ? _platformPairFromOffset(groundOverlay.anchor!) - : null, + anchor: groundOverlay.anchor != null + ? _platformPairFromOffset(groundOverlay.anchor!) + : null, image: platformBitmapFromBitmapDescriptor(groundOverlay.image), - position: - groundOverlay.position != null - ? _platformLatLngFromLatLng(groundOverlay.position!) - : null, + position: groundOverlay.position != null + ? _platformLatLngFromLatLng(groundOverlay.position!) + : null, bounds: _platformLatLngBoundsFromLatLngBounds(groundOverlay.bounds), visible: groundOverlay.visible, zIndex: groundOverlay.zIndex, @@ -855,12 +852,14 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { } static PlatformPolygon _platformPolygonFromPolygon(Polygon polygon) { - final List points = - polygon.points.map(_platformLatLngFromLatLng).toList(); - final List> holes = - polygon.holes.map((List hole) { - return hole.map(_platformLatLngFromLatLng).toList(); - }).toList(); + final List points = polygon.points + .map(_platformLatLngFromLatLng) + .toList(); + final List> holes = polygon.holes.map(( + List hole, + ) { + return hole.map(_platformLatLngFromLatLng).toList(); + }).toList(); return PlatformPolygon( polygonId: polygon.polygonId.value, fillColor: polygon.fillColor.value, @@ -876,10 +875,12 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { } static PlatformPolyline _platformPolylineFromPolyline(Polyline polyline) { - final List points = - polyline.points.map(_platformLatLngFromLatLng).toList(); - final List pattern = - polyline.patterns.map(platformPatternItemFromPatternItem).toList(); + final List points = polyline.points + .map(_platformLatLngFromLatLng) + .toList(); + final List pattern = polyline.patterns + .map(platformPatternItemFromPatternItem) + .toList(); return PlatformPolyline( polylineId: polyline.polylineId.value, consumesTapEvents: polyline.consumeTapEvents, @@ -955,10 +956,9 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { return PlatformCameraUpdate( cameraUpdate: PlatformCameraUpdateZoomBy( amount: update.amount, - focus: - update.focus == null - ? null - : _platformPairFromOffset(update.focus!), + focus: update.focus == null + ? null + : _platformPairFromOffset(update.focus!), ), ); case CameraUpdateType.zoomIn: @@ -1019,10 +1019,9 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { return PlatformBitmap( bitmap: PlatformBitmapBytes( byteData: bytes.byteData, - size: - (bytes.size == null) - ? null - : _platformPairFromSize(bytes.size!), + size: (bytes.size == null) + ? null + : _platformPairFromSize(bytes.size!), ), ); case final AssetBitmap asset: @@ -1036,10 +1035,9 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { bitmap: PlatformBitmapAssetImage( name: asset.name, scale: asset.scale, - size: - (asset.size == null) - ? null - : _platformPairFromSize(asset.size!), + size: (asset.size == null) + ? null + : _platformPairFromSize(asset.size!), ), ); case final AssetMapBitmap asset: @@ -1135,10 +1133,9 @@ class HostMapMessageHandler implements MapsCallbackApi { TileOverlayId(tileOverlayId), ); final TileProvider? tileProvider = tileOverlay?.tileProvider; - final Tile tile = - tileProvider == null - ? TileProvider.noTile - : await tileProvider.getTile(location.x, location.y, zoom); + final Tile tile = tileProvider == null + ? TileProvider.noTile + : await tileProvider.getTile(location.x, location.y, zoom); return _platformTileFromTile(tile); } @@ -1302,8 +1299,8 @@ PlatformCameraTargetBounds? _platformCameraTargetBoundsFromCameraTargetBounds( return bounds == null ? null : PlatformCameraTargetBounds( - bounds: _platformLatLngBoundsFromLatLngBounds(bounds.bounds), - ); + bounds: _platformLatLngBoundsFromLatLngBounds(bounds.bounds), + ); } PlatformMapType? _platformMapTypeFromMapType(MapType? type) { @@ -1342,11 +1339,11 @@ PlatformEdgeInsets? _platformEdgeInsetsFromEdgeInsets(EdgeInsets? insets) { return insets == null ? null : PlatformEdgeInsets( - top: insets.top, - bottom: insets.bottom, - left: insets.left, - right: insets.right, - ); + top: insets.top, + bottom: insets.bottom, + left: insets.left, + right: insets.right, + ); } PlatformMapConfiguration _platformMapConfigurationFromMapConfiguration( @@ -1387,8 +1384,8 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( // All of these hard-coded values and structures come from // google_maps_flutter_platform_interface/lib/src/types/utils/map_configuration_serialization.dart // to support this legacy API that relied on cross-package magic strings. - final List? padding = - (options['padding'] as List?)?.cast(); + final List? padding = (options['padding'] as List?) + ?.cast(); final int? mapType = options['mapType'] as int?; return PlatformMapConfiguration( compassEnabled: options['compassEnabled'] as bool?, @@ -1408,15 +1405,14 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( zoomGesturesEnabled: options['zoomGesturesEnabled'] as bool?, myLocationEnabled: options['myLocationEnabled'] as bool?, myLocationButtonEnabled: options['myLocationButtonEnabled'] as bool?, - padding: - padding == null - ? null - : PlatformEdgeInsets( - top: padding[0], - left: padding[1], - bottom: padding[2], - right: padding[3], - ), + padding: padding == null + ? null + : PlatformEdgeInsets( + top: padding[0], + left: padding[1], + bottom: padding[2], + right: padding[3], + ), indoorViewEnabled: options['indoorEnabled'] as bool?, trafficEnabled: options['trafficEnabled'] as bool?, buildingsEnabled: options['buildingsEnabled'] as bool?, @@ -1490,8 +1486,8 @@ PlatformZoomRange? _platformZoomRangeFromMinMaxZoomPreferenceJson( return null; } // See `MinMaxZoomPreference.toJson`. - final List minMaxZoom = - (zoomPrefsJson as List).cast(); + final List minMaxZoom = (zoomPrefsJson as List) + .cast(); return PlatformZoomRange(min: minMaxZoom[0], max: minMaxZoom[1]); } 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 6789c92799e..04d02cb3439 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 @@ -1010,12 +1010,12 @@ class PlatformMapViewCreationParams { 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?)!.cast(), - initialGroundOverlays: - (result[9] as List?)!.cast(), + initialTileOverlays: (result[7] as List?)! + .cast(), + initialClusterManagers: (result[8] as List?)! + .cast(), + initialGroundOverlays: (result[9] as List?)! + .cast(), ); } } @@ -1663,8 +1663,9 @@ class MapsApi { /// BinaryMessenger will be used which routes to the host platform. MapsApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -2412,8 +2413,9 @@ abstract class MapsCallbackApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( @@ -2980,8 +2982,9 @@ class MapsInitializerApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -3063,8 +3066,9 @@ class MapsPlatformViewApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -3105,8 +3109,9 @@ class MapsInspectorApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart index a67ebb16d36..7a9aca87b9a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart @@ -105,11 +105,10 @@ HeatmapGradient? deserializeHeatmapGradient(Object? json) { } assert(json is Map); final Map map = (json as Map).cast(); - final List colors = - (map[_heatmapGradientColorsKey]! as List) - .whereType() - .map((int e) => Color(e)) - .toList(); + final List colors = (map[_heatmapGradientColorsKey]! as List) + .whereType() + .map((int e) => Color(e)) + .toList(); final List startPoints = (map[_heatmapGradientStartPointsKey]! as List) .whereType() diff --git a/packages/google_sign_in/google_sign_in_android/example/lib/main.dart b/packages/google_sign_in/google_sign_in_android/example/lib/main.dart index 1abec9b3f9c..8ab6e537868 100644 --- a/packages/google_sign_in/google_sign_in_android/example/lib/main.dart +++ b/packages/google_sign_in/google_sign_in_android/example/lib/main.dart @@ -43,11 +43,11 @@ class SignInDemoState extends State { Future _ensureInitialized() { // The example app uses the parsing of values from google-services.json // to provide the serverClientId, otherwise it would be required here. - return _initialization ??= GoogleSignInPlatform.instance.init( - const InitParameters(), - )..catchError((dynamic _) { - _initialization = null; - }); + return _initialization ??= + GoogleSignInPlatform.instance.init(const InitParameters()) + ..catchError((dynamic _) { + _initialization = null; + }); } void _setUser(GoogleSignInUserData? user) { @@ -70,10 +70,9 @@ class SignInDemoState extends State { _setUser(result?.user); } on GoogleSignInException catch (e) { setState(() { - _errorMessage = - e.code == GoogleSignInExceptionCode.canceled - ? '' - : 'GoogleSignInException ${e.code}: ${e.description}'; + _errorMessage = e.code == GoogleSignInExceptionCode.canceled + ? '' + : 'GoogleSignInException ${e.code}: ${e.description}'; }); } } @@ -178,10 +177,9 @@ class SignInDemoState extends State { _setUser(result.user); } on GoogleSignInException catch (e) { setState(() { - _errorMessage = - e.code == GoogleSignInExceptionCode.canceled - ? '' - : 'GoogleSignInException ${e.code}: ${e.description}'; + _errorMessage = e.code == GoogleSignInExceptionCode.canceled + ? '' + : 'GoogleSignInException ${e.code}: ${e.description}'; }); } } diff --git a/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart b/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart index 7d446c37ea7..de66df6f4ba 100644 --- a/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart +++ b/packages/google_sign_in/google_sign_in_android/lib/google_sign_in_android.dart @@ -252,8 +252,9 @@ class GoogleSignInAndroid extends GoogleSignInPlatform { scopes: request.scopes, accountEmail: email, hostedDomain: _hostedDomain, - serverClientIdForForcedRefreshToken: - requestOfflineAccess ? _serverClientId : null, + serverClientIdForForcedRefreshToken: requestOfflineAccess + ? _serverClientId + : null, ), promptIfUnauthorized: request.promptIfUnauthorized, ); diff --git a/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart b/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart index a9584272f43..7de737a2395 100644 --- a/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart +++ b/packages/google_sign_in/google_sign_in_android/lib/src/messages.g.dart @@ -674,8 +674,9 @@ class GoogleSignInApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); diff --git a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart index 9abe1d6acc6..9986df72f53 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart @@ -208,8 +208,9 @@ class _MyAppState extends State<_MyApp> { final Widget storeHeader = ListTile( leading: Icon( _isAvailable ? Icons.check : Icons.block, - color: - _isAvailable ? Colors.green : ThemeData.light().colorScheme.error, + color: _isAvailable + ? Colors.green + : ThemeData.light().colorScheme.error, ), title: Text( 'The store is ${_isAvailable ? 'available' : 'unavailable'}.', @@ -454,50 +455,48 @@ class _MyAppState extends State<_MyApp> { return ListTile( title: Text(productDetails.title), subtitle: Text(productDetails.description), - trailing: - previousPurchase != null - ? const SizedBox.shrink() - : TextButton( - style: TextButton.styleFrom( - backgroundColor: Colors.green[800], - foregroundColor: Colors.white, - ), - onPressed: () { - // NOTE: If you are making a subscription purchase/upgrade/downgrade, we recommend you to - // verify the latest status of you your subscription by using server side receipt validation - // and update the UI accordingly. The subscription purchase status shown - // inside the app may not be accurate. - final GooglePlayPurchaseDetails? oldSubscription = - _getOldSubscription( - productDetails as GooglePlayProductDetails, - purchases, - ); - final GooglePlayPurchaseParam purchaseParam = - GooglePlayPurchaseParam( - productDetails: productDetails, - changeSubscriptionParam: - oldSubscription != null - ? ChangeSubscriptionParam( - oldPurchaseDetails: oldSubscription, - replacementMode: - ReplacementMode.withTimeProration, - ) - : null, - ); - if (productDetails.id == _kConsumableId) { - _inAppPurchasePlatform.buyConsumable( - purchaseParam: purchaseParam, - // ignore: avoid_redundant_argument_values - autoConsume: _kAutoConsume, + trailing: previousPurchase != null + ? const SizedBox.shrink() + : TextButton( + style: TextButton.styleFrom( + backgroundColor: Colors.green[800], + foregroundColor: Colors.white, + ), + onPressed: () { + // NOTE: If you are making a subscription purchase/upgrade/downgrade, we recommend you to + // verify the latest status of you your subscription by using server side receipt validation + // and update the UI accordingly. The subscription purchase status shown + // inside the app may not be accurate. + final GooglePlayPurchaseDetails? oldSubscription = + _getOldSubscription( + productDetails as GooglePlayProductDetails, + purchases, ); - } else { - _inAppPurchasePlatform.buyNonConsumable( - purchaseParam: purchaseParam, + final GooglePlayPurchaseParam purchaseParam = + GooglePlayPurchaseParam( + productDetails: productDetails, + changeSubscriptionParam: oldSubscription != null + ? ChangeSubscriptionParam( + oldPurchaseDetails: oldSubscription, + replacementMode: + ReplacementMode.withTimeProration, + ) + : null, ); - } - }, - child: Text(productDetails.price), - ), + if (productDetails.id == _kConsumableId) { + _inAppPurchasePlatform.buyConsumable( + purchaseParam: purchaseParam, + // ignore: avoid_redundant_argument_values + autoConsume: _kAutoConsume, + ); + } else { + _inAppPurchasePlatform.buyNonConsumable( + purchaseParam: purchaseParam, + ); + } + }, + child: Text(productDetails.price), + ), ); }), ); @@ -524,16 +523,15 @@ class _MyAppState extends State<_MyApp> { const ListTile consumableHeader = ListTile( title: Text('Purchased consumables'), ); - final List tokens = - _consumables.map((String id) { - return GridTile( - child: IconButton( - icon: const Icon(Icons.stars, size: 42.0, color: Colors.orange), - splashColor: Colors.yellowAccent, - onPressed: () => consume(id), - ), - ); - }).toList(); + final List tokens = _consumables.map((String id) { + return GridTile( + child: IconButton( + icon: const Icon(Icons.stars, size: 42.0, color: Colors.orange), + splashColor: Colors.yellowAccent, + onPressed: () => consume(id), + ), + ); + }).toList(); return Card( child: Column( children: [ diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart index 1950d711f54..32664d2a34b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart @@ -37,8 +37,8 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { @visibleForTesting BillingClientManager? manager, }) : billingClientManager = manager ?? BillingClientManager() { // Register [InAppPurchaseAndroidPlatformAddition]. - InAppPurchasePlatformAddition - .instance = InAppPurchaseAndroidPlatformAddition(billingClientManager); + InAppPurchasePlatformAddition.instance = + InAppPurchaseAndroidPlatformAddition(billingClientManager); billingClientManager.purchasesUpdatedStream .asyncMap(_getPurchaseDetailsFromResult) @@ -87,28 +87,26 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { await Future.wait(>[ billingClientManager.runWithClient( (BillingClient client) => client.queryProductDetails( - productList: - identifiers - .map( - (String productId) => ProductWrapper( - productId: productId, - productType: ProductType.inapp, - ), - ) - .toList(), + productList: identifiers + .map( + (String productId) => ProductWrapper( + productId: productId, + productType: ProductType.inapp, + ), + ) + .toList(), ), ), billingClientManager.runWithClient( (BillingClient client) => client.queryProductDetails( - productList: - identifiers - .map( - (String productId) => ProductWrapper( - productId: productId, - productType: ProductType.subs, - ), - ) - .toList(), + productList: identifiers + .map( + (String productId) => ProductWrapper( + productId: productId, + productType: ProductType.subs, + ), + ) + .toList(), ), ), ]); @@ -131,36 +129,34 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { ), ]; } - final List productDetailsList = - productResponses - .expand((ProductDetailsResponseWrapper response) { - return response.productDetailsList; - }) - .expand((ProductDetailsWrapper productDetailWrapper) { - return GooglePlayProductDetails.fromProductDetails( - productDetailWrapper, - ); - }) - .toList(); - - final Set successIDS = - productDetailsList - .map((ProductDetails productDetails) => productDetails.id) - .toSet(); - final List notFoundIDS = - identifiers.difference(successIDS).toList(); + final List productDetailsList = productResponses + .expand((ProductDetailsResponseWrapper response) { + return response.productDetailsList; + }) + .expand((ProductDetailsWrapper productDetailWrapper) { + return GooglePlayProductDetails.fromProductDetails( + productDetailWrapper, + ); + }) + .toList(); + + final Set successIDS = productDetailsList + .map((ProductDetails productDetails) => productDetails.id) + .toSet(); + final List notFoundIDS = identifiers + .difference(successIDS) + .toList(); return ProductDetailsResponse( productDetails: productDetailsList, notFoundIDs: notFoundIDS, - error: - exception == null - ? null - : IAPError( - source: kIAPSource, - code: exception.code, - message: exception.message ?? '', - details: exception.details, - ), + error: exception == null + ? null + : IAPError( + source: kIAPSource, + code: exception.code, + message: exception.message ?? '', + details: exception.details, + ), ); } @@ -187,11 +183,10 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { offerToken: offerToken, accountId: purchaseParam.applicationUserName, oldProduct: changeSubscriptionParam?.oldPurchaseDetails.productID, - purchaseToken: - changeSubscriptionParam - ?.oldPurchaseDetails - .verificationData - .serverVerificationData, + purchaseToken: changeSubscriptionParam + ?.oldPurchaseDetails + .verificationData + .serverVerificationData, replacementMode: changeSubscriptionParam?.replacementMode, ), ); @@ -245,33 +240,31 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { ), ]); - final Set errorCodeSet = - responses - .where( - (PurchasesResultWrapper response) => - response.responseCode != BillingResponse.ok, - ) - .map( - (PurchasesResultWrapper response) => - response.responseCode.toString(), - ) - .toSet(); - - final String errorMessage = - errorCodeSet.isNotEmpty ? errorCodeSet.join(', ') : ''; - - final List pastPurchases = - responses - .expand((PurchasesResultWrapper response) => response.purchasesList) - .expand( - (PurchaseWrapper purchaseWrapper) => - GooglePlayPurchaseDetails.fromPurchase(purchaseWrapper), - ) - .map( - (GooglePlayPurchaseDetails details) => - details..status = PurchaseStatus.restored, - ) - .toList(); + final Set errorCodeSet = responses + .where( + (PurchasesResultWrapper response) => + response.responseCode != BillingResponse.ok, + ) + .map( + (PurchasesResultWrapper response) => response.responseCode.toString(), + ) + .toSet(); + + final String errorMessage = errorCodeSet.isNotEmpty + ? errorCodeSet.join(', ') + : ''; + + final List pastPurchases = responses + .expand((PurchasesResultWrapper response) => response.purchasesList) + .expand( + (PurchaseWrapper purchaseWrapper) => + GooglePlayPurchaseDetails.fromPurchase(purchaseWrapper), + ) + .map( + (GooglePlayPurchaseDetails details) => + details..status = PurchaseStatus.restored, + ) + .toList(); if (errorMessage.isNotEmpty) { throw InAppPurchaseException( @@ -323,20 +316,19 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { details: resultWrapper.billingResult.debugMessage, ); } - final List> purchases = - resultWrapper.purchasesList - .expand( - (PurchaseWrapper purchase) => - GooglePlayPurchaseDetails.fromPurchase(purchase), - ) - .map((GooglePlayPurchaseDetails purchaseDetails) { - purchaseDetails.error = error; - if (resultWrapper.responseCode == BillingResponse.userCanceled) { - purchaseDetails.status = PurchaseStatus.canceled; - } - return _maybeAutoConsumePurchase(purchaseDetails); - }) - .toList(); + final List> purchases = resultWrapper.purchasesList + .expand( + (PurchaseWrapper purchase) => + GooglePlayPurchaseDetails.fromPurchase(purchase), + ) + .map((GooglePlayPurchaseDetails purchaseDetails) { + purchaseDetails.error = error; + if (resultWrapper.responseCode == BillingResponse.userCanceled) { + purchaseDetails.status = PurchaseStatus.canceled; + } + return _maybeAutoConsumePurchase(purchaseDetails); + }) + .toList(); if (purchases.isNotEmpty) { return Future.wait(purchases); } else { diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart index aa9886337cc..e4d27cdb99b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart @@ -96,29 +96,27 @@ class InAppPurchaseAndroidPlatformAddition ]; } - final Set errorCodeSet = - responses - .where( - (PurchasesResultWrapper response) => - response.responseCode != BillingResponse.ok, - ) - .map( - (PurchasesResultWrapper response) => - response.responseCode.toString(), - ) - .toSet(); - - final String errorMessage = - errorCodeSet.isNotEmpty ? errorCodeSet.join(', ') : ''; - - final List pastPurchases = - responses - .expand((PurchasesResultWrapper response) => response.purchasesList) - .expand( - (PurchaseWrapper purchaseWrapper) => - GooglePlayPurchaseDetails.fromPurchase(purchaseWrapper), - ) - .toList(); + final Set errorCodeSet = responses + .where( + (PurchasesResultWrapper response) => + response.responseCode != BillingResponse.ok, + ) + .map( + (PurchasesResultWrapper response) => response.responseCode.toString(), + ) + .toSet(); + + final String errorMessage = errorCodeSet.isNotEmpty + ? errorCodeSet.join(', ') + : ''; + + final List pastPurchases = responses + .expand((PurchasesResultWrapper response) => response.purchasesList) + .expand( + (PurchaseWrapper purchaseWrapper) => + GooglePlayPurchaseDetails.fromPurchase(purchaseWrapper), + ) + .toList(); IAPError? error; if (exception != null) { diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart index 9b4c32ca068..053e1f3c8f0 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart @@ -237,9 +237,8 @@ class PlatformProductDetails { title: result[4]! as String, oneTimePurchaseOfferDetails: result[5] as PlatformOneTimePurchaseOfferDetails?, - subscriptionOfferDetails: - (result[6] as List?) - ?.cast(), + subscriptionOfferDetails: (result[6] as List?) + ?.cast(), ); } } @@ -264,8 +263,8 @@ class PlatformProductDetailsResponse { result as List; return PlatformProductDetailsResponse( billingResult: result[0]! as PlatformBillingResult, - productDetails: - (result[1] as List?)!.cast(), + productDetails: (result[1] as List?)! + .cast(), ); } } @@ -611,8 +610,8 @@ class PlatformPurchaseHistoryResponse { result as List; return PlatformPurchaseHistoryResponse( billingResult: result[0]! as PlatformBillingResult, - purchases: - (result[1] as List?)!.cast(), + purchases: (result[1] as List?)! + .cast(), ); } } @@ -683,8 +682,8 @@ class PlatformSubscriptionOfferDetails { offerId: result[1] as String?, offerToken: result[2]! as String, offerTags: (result[3] as List?)!.cast(), - pricingPhases: - (result[4] as List?)!.cast(), + pricingPhases: (result[4] as List?)! + .cast(), installmentPlanDetails: result[5] as PlatformInstallmentPlanDetails?, ); } @@ -717,8 +716,8 @@ class PlatformUserChoiceDetails { return PlatformUserChoiceDetails( originalExternalTransactionId: result[0] as String?, externalTransactionToken: result[1]! as String, - products: - (result[2] as List?)!.cast(), + products: (result[2] as List?)! + .cast(), ); } } @@ -973,8 +972,9 @@ class InAppPurchaseApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -1438,8 +1438,9 @@ abstract class InAppPurchaseCallbackApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart index f3a455b7f87..c3586df9c6a 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart @@ -35,8 +35,9 @@ ProductDetailsResponseWrapper productDetailsResponseWrapperFromPlatform( ) { return ProductDetailsResponseWrapper( billingResult: resultWrapperFromPlatform(response.billingResult), - productDetailsList: - response.productDetails.map(productDetailsWrapperFromPlatform).toList(), + productDetailsList: response.productDetails + .map(productDetailsWrapperFromPlatform) + .toList(), ); } @@ -53,10 +54,9 @@ ProductDetailsWrapper productDetailsWrapperFromPlatform( oneTimePurchaseOfferDetails: oneTimePurchaseOfferDetailsWrapperFromPlatform( product.oneTimePurchaseOfferDetails, ), - subscriptionOfferDetails: - product.subscriptionOfferDetails - ?.map(subscriptionOfferDetailsWrapperFromPlatform) - .toList(), + subscriptionOfferDetails: product.subscriptionOfferDetails + ?.map(subscriptionOfferDetailsWrapperFromPlatform) + .toList(), ); } @@ -81,10 +81,9 @@ PurchasesHistoryResult purchaseHistoryResultFromPlatform( ) { return PurchasesHistoryResult( billingResult: resultWrapperFromPlatform(response.billingResult), - purchaseHistoryRecordList: - response.purchases - .map(purchaseHistoryRecordWrapperFromPlatform) - .toList(), + purchaseHistoryRecordList: response.purchases + .map(purchaseHistoryRecordWrapperFromPlatform) + .toList(), ); } @@ -110,10 +109,9 @@ PurchasesResultWrapper purchasesResultWrapperFromPlatform( return PurchasesResultWrapper( billingResult: resultWrapperFromPlatform(response.billingResult), purchasesList: response.purchases.map(purchaseWrapperFromPlatform).toList(), - responseCode: - forceOkResponseCode - ? BillingResponse.ok - : billingResponseFromPlatform(response.billingResult.responseCode), + responseCode: forceOkResponseCode + ? BillingResponse.ok + : billingResponseFromPlatform(response.billingResult.responseCode), ); } @@ -258,8 +256,9 @@ SubscriptionOfferDetailsWrapper subscriptionOfferDetailsWrapperFromPlatform( offerId: offer.offerId, offerTags: offer.offerTags, offerIdToken: offer.offerToken, - pricingPhases: - offer.pricingPhases.map(pricingPhaseWrapperFromPlatform).toList(), + pricingPhases: offer.pricingPhases + .map(pricingPhaseWrapperFromPlatform) + .toList(), installmentPlanDetails: installmentPlanDetailsFromPlatform( offer.installmentPlanDetails, ), @@ -273,8 +272,9 @@ UserChoiceDetailsWrapper userChoiceDetailsFromPlatform( return UserChoiceDetailsWrapper( originalExternalTransactionId: details.originalExternalTransactionId ?? '', externalTransactionToken: details.externalTransactionToken, - products: - details.products.map(userChoiceDetailsProductFromPlatform).toList(), + products: details.products + .map(userChoiceDetailsProductFromPlatform) + .toList(), ); } diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart index 460659902b8..21d022e0f13 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/google_play_product_details.dart @@ -160,9 +160,9 @@ class GooglePlayProductDetails extends ProductDetails { /// object was contructed for, or `null` if it was not a subscription. String? get offerToken => subscriptionIndex != null && - productDetails.subscriptionOfferDetails != null - ? productDetails - .subscriptionOfferDetails![subscriptionIndex!] - .offerIdToken - : null; + productDetails.subscriptionOfferDetails != null + ? productDetails + .subscriptionOfferDetails![subscriptionIndex!] + .offerIdToken + : null; } diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/translator.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/translator.dart index 51dd8808c0a..d2579ea69c6 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/translator.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/translator.dart @@ -19,13 +19,12 @@ class Translator { originalExternalTransactionId: detailsWrapper.originalExternalTransactionId, externalTransactionToken: detailsWrapper.externalTransactionToken, - products: - detailsWrapper.products - .map( - (UserChoiceDetailsProductWrapper e) => - convertToUserChoiceDetailsProduct(e), - ) - .toList(), + products: detailsWrapper.products + .map( + (UserChoiceDetailsProductWrapper e) => + convertToUserChoiceDetailsProduct(e), + ) + .toList(), ); } diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart index 3f88ac8aaf3..1f21f04868d 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart @@ -154,10 +154,9 @@ void main() { ) async { timesCalled++; return BillingResultWrapper( - responseCode: - timesCalled == 1 - ? BillingResponse.serviceDisconnected - : BillingResponse.ok, + responseCode: timesCalled == 1 + ? BillingResponse.serviceDisconnected + : BillingResponse.ok, ); }); verify(mockApi.startConnection(any, any, any)).called(1); diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart index 7598f417f89..b87fe0a6742 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart @@ -489,13 +489,11 @@ void main() { responseCode: PlatformBillingResponse.ok, debugMessage: debugMessage, ), - purchases: - expectedList - .map( - (PurchaseWrapper purchase) => - convertToPigeonPurchase(purchase), - ) - .toList(), + purchases: expectedList + .map( + (PurchaseWrapper purchase) => convertToPigeonPurchase(purchase), + ) + .toList(), ), ); @@ -633,8 +631,8 @@ void main() { when( mockApi.getBillingConfigAsync(), ).thenAnswer((_) async => platformBillingConfigFromWrapper(expected)); - final BillingConfigWrapper result = - await billingClient.getBillingConfig(); + final BillingConfigWrapper result = await billingClient + .getBillingConfig(); expect(result.countryCode, 'US'); expect(result, expected); }); @@ -652,8 +650,8 @@ void main() { debugMessage: expected.debugMessage!, ), ); - final BillingResultWrapper result = - await billingClient.isAlternativeBillingOnlyAvailable(); + final BillingResultWrapper result = await billingClient + .isAlternativeBillingOnlyAvailable(); expect(result, expected); }); }); @@ -690,8 +688,8 @@ void main() { debugMessage: expected.debugMessage!, ), ); - final BillingResultWrapper result = - await billingClient.showAlternativeBillingOnlyInformationDialog(); + final BillingResultWrapper result = await billingClient + .showAlternativeBillingOnlyInformationDialog(); expect(result, expected); }); }); diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart index 80a0fa790fa..e8d4c2c38e6 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart @@ -362,28 +362,30 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { #createAlternativeBillingOnlyReportingDetailsAsync, [], ), - returnValue: _i4.Future< - _i2.PlatformAlternativeBillingOnlyReportingDetailsResponse - >.value( - _FakePlatformAlternativeBillingOnlyReportingDetailsResponse_5( - this, - Invocation.method( - #createAlternativeBillingOnlyReportingDetailsAsync, - [], + returnValue: + _i4.Future< + _i2.PlatformAlternativeBillingOnlyReportingDetailsResponse + >.value( + _FakePlatformAlternativeBillingOnlyReportingDetailsResponse_5( + this, + Invocation.method( + #createAlternativeBillingOnlyReportingDetailsAsync, + [], + ), + ), ), - ), - ), - returnValueForMissingStub: _i4.Future< - _i2.PlatformAlternativeBillingOnlyReportingDetailsResponse - >.value( - _FakePlatformAlternativeBillingOnlyReportingDetailsResponse_5( - this, - Invocation.method( - #createAlternativeBillingOnlyReportingDetailsAsync, - [], + returnValueForMissingStub: + _i4.Future< + _i2.PlatformAlternativeBillingOnlyReportingDetailsResponse + >.value( + _FakePlatformAlternativeBillingOnlyReportingDetailsResponse_5( + this, + Invocation.method( + #createAlternativeBillingOnlyReportingDetailsAsync, + [], + ), + ), ), - ), - ), ) as _i4.Future< _i2.PlatformAlternativeBillingOnlyReportingDetailsResponse diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart index d7edc418f0f..93fec10b283 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart @@ -76,8 +76,8 @@ void main() { when( mockApi.getBillingConfigAsync(), ).thenAnswer((_) async => platformBillingConfigFromWrapper(expected)); - final String countryCode = - await iapAndroidPlatformAddition.getCountryCode(); + final String countryCode = await iapAndroidPlatformAddition + .getCountryCode(); expect(countryCode, equals(expectedCountryCode)); }); @@ -133,8 +133,8 @@ void main() { ), ); - final BillingResultWrapper result = - await iapAndroidPlatformAddition.isAlternativeBillingOnlyAvailable(); + final BillingResultWrapper result = await iapAndroidPlatformAddition + .isAlternativeBillingOnlyAvailable(); expect(result, equals(expected)); }); @@ -153,8 +153,8 @@ void main() { when( mockApi.showAlternativeBillingOnlyInformationDialog(), ).thenAnswer((_) async => convertToPigeonResult(expected)); - final BillingResultWrapper result = - await iapAndroidPlatformAddition.isAlternativeBillingOnlyAvailable(); + final BillingResultWrapper result = await iapAndroidPlatformAddition + .isAlternativeBillingOnlyAvailable(); expect(result, equals(expected)); }); diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart index 5c72fd7b190..908e89542aa 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart @@ -114,10 +114,9 @@ void main() { debugMessage: '', ); }); - final PurchaseDetails purchase = - GooglePlayPurchaseDetails.fromPurchase( - dummyUnacknowledgedPurchase, - ).first; + final PurchaseDetails purchase = GooglePlayPurchaseDetails.fromPurchase( + dummyUnacknowledgedPurchase, + ).first; final BillingResultWrapper result = await iapAndroidPlatform .completePurchase(purchase); verify(mockApi.acknowledgePurchase(any)).called(2); @@ -379,8 +378,9 @@ void main() { final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( offerToken: productDetails.subscriptionOfferDetails?.first.offerIdToken, - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, ); final bool launchResult = await iapAndroidPlatform.buyNonConsumable( @@ -443,8 +443,9 @@ void main() { subscription.cancel(); }, onDone: () {}); final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, ); final bool launchResult = await iapAndroidPlatform.buyNonConsumable( @@ -491,8 +492,9 @@ void main() { subscription.cancel(); }, onDone: () {}); final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, ); await iapAndroidPlatform.buyNonConsumable(purchaseParam: purchaseParam); @@ -572,8 +574,9 @@ void main() { subscription.cancel(); }, onDone: () {}); final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, ); final bool launchResult = await iapAndroidPlatform.buyConsumable( @@ -609,10 +612,9 @@ void main() { final bool result = await iapAndroidPlatform.buyNonConsumable( purchaseParam: GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails( - dummyOneTimeProductDetails, - ).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + dummyOneTimeProductDetails, + ).first, ), ); @@ -636,10 +638,9 @@ void main() { final bool result = await iapAndroidPlatform.buyConsumable( purchaseParam: GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails( - dummyOneTimeProductDetails, - ).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + dummyOneTimeProductDetails, + ).first, ), ); @@ -710,8 +711,9 @@ void main() { subscription.cancel(); }, onDone: () {}); final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, ); await iapAndroidPlatform.buyConsumable(purchaseParam: purchaseParam); @@ -793,8 +795,9 @@ void main() { subscription.cancel(); }, onDone: () {}); final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, ); await iapAndroidPlatform.buyConsumable( @@ -872,8 +875,9 @@ void main() { subscription.cancel(); }, onDone: () {}); final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, ); await iapAndroidPlatform.buyConsumable(purchaseParam: purchaseParam); @@ -921,14 +925,14 @@ void main() { subscription.cancel(); }, onDone: () {}); final GooglePlayPurchaseParam purchaseParam = GooglePlayPurchaseParam( - productDetails: - GooglePlayProductDetails.fromProductDetails(productDetails).first, + productDetails: GooglePlayProductDetails.fromProductDetails( + productDetails, + ).first, applicationUserName: accountId, changeSubscriptionParam: ChangeSubscriptionParam( - oldPurchaseDetails: - GooglePlayPurchaseDetails.fromPurchase( - dummyUnacknowledgedPurchase, - ).first, + oldPurchaseDetails: GooglePlayPurchaseDetails.fromPurchase( + dummyUnacknowledgedPurchase, + ).first, replacementMode: ReplacementMode.deferred, ), ); diff --git a/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart b/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart index 55b93993539..b80ab357458 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart @@ -36,12 +36,12 @@ PlatformPurchase convertToPigeonPurchase(PurchaseWrapper purchase) { quantity: 99, accountIdentifiers: purchase.obfuscatedAccountId != null || - purchase.obfuscatedProfileId != null - ? PlatformAccountIdentifiers( - obfuscatedAccountId: purchase.obfuscatedAccountId, - obfuscatedProfileId: purchase.obfuscatedProfileId, - ) - : null, + purchase.obfuscatedProfileId != null + ? PlatformAccountIdentifiers( + obfuscatedAccountId: purchase.obfuscatedAccountId, + obfuscatedProfileId: purchase.obfuscatedProfileId, + ) + : null, ); } @@ -58,10 +58,9 @@ PlatformProductDetails convertToPigeonProductDetails( oneTimePurchaseOfferDetails: _convertToPigeonOneTimePurchaseOfferDetails( details.oneTimePurchaseOfferDetails, ), - subscriptionOfferDetails: - details.subscriptionOfferDetails - ?.map(convertToPigeonSubscriptionOfferDetails) - .toList(), + subscriptionOfferDetails: details.subscriptionOfferDetails + ?.map(convertToPigeonSubscriptionOfferDetails) + .toList(), ); } @@ -73,8 +72,9 @@ PlatformSubscriptionOfferDetails convertToPigeonSubscriptionOfferDetails( offerId: details.offerId, offerToken: details.offerIdToken, offerTags: details.offerTags, - pricingPhases: - details.pricingPhases.map(convertToPigeonPricingPhase).toList(), + pricingPhases: details.pricingPhases + .map(convertToPigeonPricingPhase) + .toList(), ); } diff --git a/packages/path_provider/path_provider_android/lib/messages.g.dart b/packages/path_provider/path_provider_android/lib/messages.g.dart index 088f959cd24..bd7104e83bb 100644 --- a/packages/path_provider/path_provider_android/lib/messages.g.dart +++ b/packages/path_provider/path_provider_android/lib/messages.g.dart @@ -81,8 +81,9 @@ class PathProviderApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); diff --git a/packages/path_provider/path_provider_android/test/messages_test.g.dart b/packages/path_provider/path_provider_android/test/messages_test.g.dart index d5fd46f85ca..bb8404324e9 100644 --- a/packages/path_provider/path_provider_android/test/messages_test.g.dart +++ b/packages/path_provider/path_provider_android/test/messages_test.g.dart @@ -64,8 +64,9 @@ abstract class TestPathProviderApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( diff --git a/packages/video_player/video_player_android/example/integration_test/video_player_test.dart b/packages/video_player/video_player_android/example/integration_test/video_player_test.dart index 6fd4d6f1e45..d7e9758fec3 100644 --- a/packages/video_player/video_player_android/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_android/example/integration_test/video_player_test.dart @@ -43,10 +43,9 @@ void main() { }); testWidgets('initializes at the start', (_) async { - final int playerId = - (await player.create( - DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), - ))!; + final int playerId = (await player.create( + DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), + ))!; expect( await _getDuration(player, playerId), @@ -57,10 +56,9 @@ void main() { }); testWidgets('can be played', (WidgetTester tester) async { - final int playerId = - (await player.create( - DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), - ))!; + final int playerId = (await player.create( + DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), + ))!; await player.play(playerId); await tester.pumpAndSettle(_playDuration); @@ -70,10 +68,9 @@ void main() { }); testWidgets('can seek', (WidgetTester tester) async { - final int playerId = - (await player.create( - DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), - ))!; + final int playerId = (await player.create( + DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), + ))!; await player.seekTo(playerId, const Duration(seconds: 3)); await tester.pumpAndSettle(_playDuration); @@ -86,10 +83,9 @@ void main() { }); testWidgets('can pause', (WidgetTester tester) async { - final int playerId = - (await player.create( - DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), - ))!; + final int playerId = (await player.create( + DataSource(sourceType: DataSourceType.asset, asset: _videoAssetKey), + ))!; await player.play(playerId); await tester.pumpAndSettle(_playDuration); @@ -112,10 +108,9 @@ void main() { ), ); - final int playerId = - (await player.create( - DataSource(sourceType: DataSourceType.file, uri: file.path), - ))!; + final int playerId = (await player.create( + DataSource(sourceType: DataSourceType.file, uri: file.path), + ))!; await player.play(playerId); await tester.pumpAndSettle(_playDuration); @@ -126,13 +121,12 @@ void main() { }); testWidgets('can play a video from network', (WidgetTester tester) async { - final int playerId = - (await player.create( - DataSource( - sourceType: DataSourceType.network, - uri: getUrlForAssetAsNetworkSource(_videoAssetKey), - ), - ))!; + final int playerId = (await player.create( + DataSource( + sourceType: DataSourceType.network, + uri: getUrlForAssetAsNetworkSource(_videoAssetKey), + ), + ))!; await player.play(playerId); await player.seekTo(playerId, const Duration(seconds: 5)); diff --git a/packages/video_player/video_player_android/example/lib/main.dart b/packages/video_player/video_player_android/example/lib/main.dart index 6f190ba5639..cf8f341e998 100644 --- a/packages/video_player/video_player_android/example/lib/main.dart +++ b/packages/video_player/video_player_android/example/lib/main.dart @@ -34,15 +34,15 @@ class _App extends StatelessWidget { body: TabBarView( children: [ _ViewTypeTabBar( - builder: - (VideoViewType viewType) => _BumbleBeeRemoteVideo(viewType), + builder: (VideoViewType viewType) => + _BumbleBeeRemoteVideo(viewType), ), _ViewTypeTabBar( builder: (VideoViewType viewType) => _RtspRemoteVideo(viewType), ), _ViewTypeTabBar( - builder: - (VideoViewType viewType) => _ButterFlyAssetVideo(viewType), + builder: (VideoViewType viewType) => + _ButterFlyAssetVideo(viewType), ), ], ), @@ -331,21 +331,20 @@ class _ControlsOverlay extends StatelessWidget { AnimatedSwitcher( duration: const Duration(milliseconds: 50), reverseDuration: const Duration(milliseconds: 200), - child: - controller.value.isPlaying - ? const SizedBox.shrink() - : const ColoredBox( - color: Colors.black26, - child: Center( - child: Icon( - key: ValueKey('Play'), - Icons.play_arrow, - color: Colors.white, - size: 100.0, - semanticLabel: 'Play', - ), + child: controller.value.isPlaying + ? const SizedBox.shrink() + : const ColoredBox( + color: Colors.black26, + child: Center( + child: Icon( + key: ValueKey('Play'), + Icons.play_arrow, + color: Colors.white, + size: 100.0, + semanticLabel: 'Play', ), ), + ), ), GestureDetector( onTap: () { diff --git a/packages/video_player/video_player_android/example/lib/mini_controller.dart b/packages/video_player/video_player_android/example/lib/mini_controller.dart index ec52735d09f..0068b25ecc4 100644 --- a/packages/video_player/video_player_android/example/lib/mini_controller.dart +++ b/packages/video_player/video_player_android/example/lib/mini_controller.dart @@ -443,11 +443,11 @@ class _VideoPlayerState extends State { return _playerId == MiniController.kUninitializedPlayerId ? Container() : _VideoPlayerWithRotation( - rotation: widget.controller.value.rotationCorrection, - child: _platform.buildViewWithOptions( - VideoViewOptions(playerId: _playerId), - ), - ); + rotation: widget.controller.value.rotationCorrection, + child: _platform.buildViewWithOptions( + VideoViewOptions(playerId: _playerId), + ), + ); } } diff --git a/packages/video_player/video_player_android/lib/src/messages.g.dart b/packages/video_player/video_player_android/lib/src/messages.g.dart index 1b79bb0678e..7701c6f4647 100644 --- a/packages/video_player/video_player_android/lib/src/messages.g.dart +++ b/packages/video_player/video_player_android/lib/src/messages.g.dart @@ -105,8 +105,8 @@ class CreationOptions { return CreationOptions( uri: result[0]! as String, formatHint: result[1] as PlatformVideoFormat?, - httpHeaders: - (result[2] as Map?)!.cast(), + httpHeaders: (result[2] as Map?)! + .cast(), userAgent: result[3] as String?, ); } @@ -265,8 +265,9 @@ class AndroidVideoPlayerApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -457,8 +458,9 @@ class VideoPlayerInstanceApi { BinaryMessenger? binaryMessenger, String messageChannelSuffix = '', }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); diff --git a/packages/video_player/video_player_android/lib/src/platform_view_player.dart b/packages/video_player/video_player_android/lib/src/platform_view_player.dart index 9f32e312359..84d21540043 100644 --- a/packages/video_player/video_player_android/lib/src/platform_view_player.dart +++ b/packages/video_player/video_player_android/lib/src/platform_view_player.dart @@ -28,16 +28,15 @@ class PlatformViewPlayer extends StatelessWidget { return IgnorePointer( child: PlatformViewLink( viewType: viewType, - surfaceFactory: ( - BuildContext context, - PlatformViewController controller, - ) { - return AndroidViewSurface( - controller: controller as AndroidViewController, - gestureRecognizers: const >{}, - hitTestBehavior: PlatformViewHitTestBehavior.opaque, - ); - }, + surfaceFactory: + (BuildContext context, PlatformViewController controller) { + return AndroidViewSurface( + controller: controller as AndroidViewController, + gestureRecognizers: + const >{}, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, onCreatePlatformView: (PlatformViewCreationParams params) { return PlatformViewsService.initSurfaceAndroidView( id: params.id, diff --git a/packages/video_player/video_player_android/test/android_video_player_test.dart b/packages/video_player/video_player_android/test/android_video_player_test.dart index 1efa32459b2..efc2c2e7aec 100644 --- a/packages/video_player/video_player_android/test/android_video_player_test.dart +++ b/packages/video_player/video_player_android/test/android_video_player_test.dart @@ -45,33 +45,24 @@ void main() { group('AndroidVideoPlayer', () { test('init', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1); await player.init(); verify(api.initialize()); }); test('dispose', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1); await player.dispose(1); verify(api.dispose(1)); }); test('create with asset', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); const int newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), @@ -106,11 +97,8 @@ void main() { }); test('create with network', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); const int newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), @@ -141,11 +129,8 @@ void main() { }); test('create with network passes headers', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); when( api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); @@ -169,11 +154,8 @@ void main() { }); test('create with network sets a default user agent', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); when( api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); @@ -194,11 +176,8 @@ void main() { }); test('create with network uses user agent from headers', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); when( api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); @@ -223,11 +202,8 @@ void main() { }); test('create with file', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); when( api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); @@ -249,11 +225,8 @@ void main() { }); test('create with file passes headers', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); when( api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); @@ -278,11 +251,8 @@ void main() { }); test('createWithOptions with asset', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); const int newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), @@ -320,11 +290,8 @@ void main() { }); test('createWithOptions with network', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); const int newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), @@ -358,11 +325,8 @@ void main() { }); test('createWithOptions with network passes headers', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); const int newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), @@ -392,11 +356,8 @@ void main() { }); test('createWithOptions with file', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); const int newPlayerId = 2; when(api.createForTextureView(any)).thenAnswer( (_) async => TexturePlayerIds(playerId: newPlayerId, textureId: 100), @@ -424,11 +385,8 @@ void main() { }); test('createWithOptions with file passes headers', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1, textureId: 100); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1, textureId: 100); when( api.createForTextureView(any), ).thenAnswer((_) async => TexturePlayerIds(playerId: 2, textureId: 100)); @@ -457,11 +415,8 @@ void main() { }); test('createWithOptions with platform view', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1); const int newPlayerId = 2; when(api.createForPlatformView(any)).thenAnswer((_) async => newPlayerId); @@ -491,7 +446,9 @@ void main() { AndroidVideoPlayer player, _, MockVideoPlayerInstanceApi playerApi, - ) = setUpMockPlayer(playerId: 1); + ) = setUpMockPlayer( + playerId: 1, + ); await player.setLooping(1, true); verify(playerApi.setLooping(true)); @@ -502,7 +459,9 @@ void main() { AndroidVideoPlayer player, _, MockVideoPlayerInstanceApi playerApi, - ) = setUpMockPlayer(playerId: 1); + ) = setUpMockPlayer( + playerId: 1, + ); await player.play(1); verify(playerApi.play()); @@ -513,7 +472,9 @@ void main() { AndroidVideoPlayer player, _, MockVideoPlayerInstanceApi playerApi, - ) = setUpMockPlayer(playerId: 1); + ) = setUpMockPlayer( + playerId: 1, + ); await player.pause(1); verify(playerApi.pause()); @@ -521,22 +482,16 @@ void main() { group('setMixWithOthers', () { test('passes true', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1); await player.setMixWithOthers(true); verify(api.setMixWithOthers(true)); }); test('passes false', () async { - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: 1); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: 1); await player.setMixWithOthers(false); verify(api.setMixWithOthers(false)); @@ -548,7 +503,9 @@ void main() { AndroidVideoPlayer player, _, MockVideoPlayerInstanceApi playerApi, - ) = setUpMockPlayer(playerId: 1); + ) = setUpMockPlayer( + playerId: 1, + ); const double volume = 0.7; await player.setVolume(1, volume); @@ -560,7 +517,9 @@ void main() { AndroidVideoPlayer player, _, MockVideoPlayerInstanceApi playerApi, - ) = setUpMockPlayer(playerId: 1); + ) = setUpMockPlayer( + playerId: 1, + ); const double speed = 1.5; await player.setPlaybackSpeed(1, speed); @@ -572,7 +531,9 @@ void main() { AndroidVideoPlayer player, _, MockVideoPlayerInstanceApi playerApi, - ) = setUpMockPlayer(playerId: 1); + ) = setUpMockPlayer( + playerId: 1, + ); const int positionMilliseconds = 12345; await player.seekTo( 1, @@ -587,7 +548,9 @@ void main() { AndroidVideoPlayer player, _, MockVideoPlayerInstanceApi playerApi, - ) = setUpMockPlayer(playerId: 1); + ) = setUpMockPlayer( + playerId: 1, + ); const int positionMilliseconds = 12345; when(playerApi.getPlaybackState()).thenAnswer( (_) async => PlaybackState( @@ -724,11 +687,8 @@ void main() { // Creating the player triggers the stream listener, so that must be done // after setting up the mock native handler above. - final ( - AndroidVideoPlayer player, - MockAndroidVideoPlayerApi api, - _, - ) = setUpMockPlayer(playerId: playerId); + final (AndroidVideoPlayer player, MockAndroidVideoPlayerApi api, _) = + setUpMockPlayer(playerId: playerId); expect( player.videoEventsFor(playerId), From 33dbb858e015103668188da10d14ed3f28f4011f Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Thu, 9 Oct 2025 15:44:47 -0400 Subject: [PATCH 08/14] Format toolig --- script/tool/lib/src/gradle_check_command.dart | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/script/tool/lib/src/gradle_check_command.dart b/script/tool/lib/src/gradle_check_command.dart index dc299a160b2..70648b367e0 100644 --- a/script/tool/lib/src/gradle_check_command.dart +++ b/script/tool/lib/src/gradle_check_command.dart @@ -360,14 +360,18 @@ build.gradle "namespace" must match the "package" attribute in AndroidManifest.x final bool hasLanguageVersion = gradleLines.any((String line) => line.contains('languageVersion') && !_isCommented(line)); final bool hasCompabilityVersions = gradleLines.any((String line) => - line.contains('sourceCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && !_isCommented(line)) && + line.contains( + 'sourceCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && + !_isCommented(line)) && // Newer toolchains default targetCompatibility to the same value as // sourceCompatibility, but older toolchains require it to be set // explicitly. The exact version cutoff (and of which piece of the // toolchain; likely AGP) is unknown; for context see // https://github.com/flutter/flutter/issues/125482 gradleLines.any((String line) => - line.contains('targetCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && !_isCommented(line)); + line.contains( + 'targetCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && + !_isCommented(line)); if (!hasLanguageVersion && !hasCompabilityVersions) { const String javaErrorMessage = ''' build.gradle(.kts) must set an explicit Java compatibility version. @@ -395,7 +399,8 @@ for more details.'''; '$indentation${javaErrorMessage.split('\n').join('\n$indentation')}'); return false; } - bool isKotlinOptions(String line) => line.contains('kotlinOptions') && !_isCommented(line); + bool isKotlinOptions(String line) => + line.contains('kotlinOptions') && !_isCommented(line); final bool hasKotlinOptions = gradleLines.any(isKotlinOptions); final bool kotlinOptionsUsesJavaVersion = gradleLines.any((String line) => line.contains('jvmTarget = JavaVersion.VERSION_$requiredJavaVersion') && @@ -404,8 +409,11 @@ for more details.'''; if (hasKotlinOptions && !kotlinOptionsUsesJavaVersion) { // Bad lines contains the first 4 lines including the kotlinOptions section. String badLines = ''; - final int startIndex = gradleLines.indexOf(gradleLines.firstWhere(isKotlinOptions)); - for(int i = startIndex; i < math.min(startIndex + 4, gradleLines.length); i++) { + final int startIndex = + gradleLines.indexOf(gradleLines.firstWhere(isKotlinOptions)); + for (int i = startIndex; + i < math.min(startIndex + 4, gradleLines.length); + i++) { badLines += '${gradleLines[i]}\n'; } final String kotlinErrorMessage = ''' From cbb7daf4f54f52e9b9991a2a166a94c49116f052 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 10 Oct 2025 11:04:19 -0400 Subject: [PATCH 09/14] bump interactive_media_ads min flutter version --- packages/interactive_media_ads/CHANGELOG.md | 2 +- packages/interactive_media_ads/pubspec.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index 24bed670fa0..8a7930eec08 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.2.8+2 -* Updates Java compatibility version to 17. +* Updates Java compatibility version to 17 and minimum supported SDK version to Flutter 3.35/Dart 3.9. ## 0.2.8+1 diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index 65070fb1ec4..1a14463a93b 100644 --- a/packages/interactive_media_ads/pubspec.yaml +++ b/packages/interactive_media_ads/pubspec.yaml @@ -7,8 +7,8 @@ version: 0.2.8+2 # This must match the version in # `ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift` environment: - sdk: ^3.7.0 - flutter: ">=3.29.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: From 5f94ec222857b7d30ea115da02e7d847fd75f846 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Fri, 10 Oct 2025 11:58:52 -0400 Subject: [PATCH 10/14] Update gradle-check to support minimum java version and validating java version alignment --- script/tool/lib/src/gradle_check_command.dart | 53 +++++++++-- .../tool/test/gradle_check_command_test.dart | 95 +++++++++++++++++-- 2 files changed, 131 insertions(+), 17 deletions(-) diff --git a/script/tool/lib/src/gradle_check_command.dart b/script/tool/lib/src/gradle_check_command.dart index 70648b367e0..fd993db06bd 100644 --- a/script/tool/lib/src/gradle_check_command.dart +++ b/script/tool/lib/src/gradle_check_command.dart @@ -356,12 +356,11 @@ build.gradle "namespace" must match the "package" attribute in AndroidManifest.x /// than using whatever the client's local toolchaing defaults to (which can /// lead to compile errors that show up for clients, but not in CI). bool _validateCompatibilityVersions(List gradleLines) { - const String requiredJavaVersion = '17'; + const int minimumJavaVersion = 17; final bool hasLanguageVersion = gradleLines.any((String line) => line.contains('languageVersion') && !_isCommented(line)); final bool hasCompabilityVersions = gradleLines.any((String line) => - line.contains( - 'sourceCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && + line.contains('sourceCompatibility = JavaVersion.VERSION_') && !_isCommented(line)) && // Newer toolchains default targetCompatibility to the same value as // sourceCompatibility, but older toolchains require it to be set @@ -369,8 +368,7 @@ build.gradle "namespace" must match the "package" attribute in AndroidManifest.x // toolchain; likely AGP) is unknown; for context see // https://github.com/flutter/flutter/issues/125482 gradleLines.any((String line) => - line.contains( - 'targetCompatibility = JavaVersion.VERSION_$requiredJavaVersion') && + line.contains('targetCompatibility = JavaVersion.VERSION_') && !_isCommented(line)); if (!hasLanguageVersion && !hasCompabilityVersions) { const String javaErrorMessage = ''' @@ -379,15 +377,15 @@ build.gradle(.kts) must set an explicit Java compatibility version. This can be done either via "sourceCompatibility"/"targetCompatibility": android { compileOptions { - sourceCompatibility = JavaVersion.VERSION_$requiredJavaVersion - targetCompatibility = JavaVersion.VERSION_$requiredJavaVersion + sourceCompatibility = JavaVersion.VERSION_$minimumJavaVersion + targetCompatibility = JavaVersion.VERSION_$minimumJavaVersion } } or "toolchain": java { toolchain { - languageVersion = JavaLanguageVersion.of($requiredJavaVersion) + languageVersion = JavaLanguageVersion.of($minimumJavaVersion) } } @@ -403,7 +401,7 @@ for more details.'''; line.contains('kotlinOptions') && !_isCommented(line); final bool hasKotlinOptions = gradleLines.any(isKotlinOptions); final bool kotlinOptionsUsesJavaVersion = gradleLines.any((String line) => - line.contains('jvmTarget = JavaVersion.VERSION_$requiredJavaVersion') && + line.contains('jvmTarget = JavaVersion.VERSION_') && !_isCommented(line)); // Either does not set kotlinOptions or does and uses non-string based syntax. if (hasKotlinOptions && !kotlinOptionsUsesJavaVersion) { @@ -421,7 +419,7 @@ If build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax. Good: android { kotlinOptions { - jvmTarget = JavaVersion.VERSION_$requiredJavaVersion.toString() + jvmTarget = JavaVersion.VERSION_$minimumJavaVersion.toString() } } BAD: @@ -432,6 +430,41 @@ If build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax. return false; } + final List javaVersions = []; + // Some java versions have the format VERSION_1_8 but we dont need to handle those + // because they are below the minimum. + final RegExp javaVersionMatcher = + RegExp(r'JavaVersion.VERSION_(?\d+)'); + for (final String line in gradleLines) { + final RegExpMatch? match = javaVersionMatcher.firstMatch(line); + if (!_isCommented(line) && match != null) { + final String? foundVersion = match.namedGroup('javaVersion'); + if (foundVersion != null) { + javaVersions.add(foundVersion); + } + } + } + if (javaVersions.isNotEmpty) { + final int version = int.parse(javaVersions.first); + if (version < minimumJavaVersion) { + final String minimumJavaVersionError = ''' +build.gradle(.kts) uses "JavaVersion.VERSION_$version". +Which is below the minimum required. Use at least "JavaVersion.VERSION_$minimumJavaVersion". +'''; + printError( + '$indentation${minimumJavaVersionError.split('\n').join('\n$indentation')}'); + return false; + } + if (!javaVersions.every((String element) => element == '$version')) { + const String javaVersionAlignmentError = ''' +If build.gradle(.kts) uses JavaVersion.* versions must be the same. +'''; + printError( + '$indentation${javaVersionAlignmentError.split('\n').join('\n$indentation')}'); + return false; + } + } + return true; } diff --git a/script/tool/test/gradle_check_command_test.dart b/script/tool/test/gradle_check_command_test.dart index 865f37ffdfc..7198a162ed0 100644 --- a/script/tool/test/gradle_check_command_test.dart +++ b/script/tool/test/gradle_check_command_test.dart @@ -50,7 +50,9 @@ void main() { String compileSdk = '36', bool includeKotlinOptions = true, bool commentKotlinOptions = false, - bool useDeprecatedJvmTarget = false, + bool useDeprecatedJvmTargetStyle = false, + int jvmTargetValue = 17, + int kotlinJvmValue = 17, }) { final File buildGradle = package .platformDirectory(FlutterPlatform.android) @@ -74,16 +76,17 @@ java { '''; final String sourceCompat = - '${commentSourceLanguage ? '// ' : ''}sourceCompatibility = JavaVersion.VERSION_17'; + '${commentSourceLanguage ? '// ' : ''}sourceCompatibility = JavaVersion.VERSION_$jvmTargetValue'; final String targetCompat = - '${commentSourceLanguage ? '// ' : ''}targetCompatibility = JavaVersion.VERSION_17'; + '${commentSourceLanguage ? '// ' : ''}targetCompatibility = JavaVersion.VERSION_$jvmTargetValue'; final String namespace = " ${commentNamespace ? '// ' : ''}namespace = '$_defaultFakeNamespace'"; - final String jvmTarget = - useDeprecatedJvmTarget ? '17' : 'JavaVersion.VERSION_17.toString()'; + final String kotlinJvmTarget = useDeprecatedJvmTargetStyle + ? '$jvmTargetValue' + : 'JavaVersion.VERSION_$kotlinJvmValue.toString()'; final String kotlinConfig = ''' ${commentKotlinOptions ? '//' : ''}kotlinOptions { - ${commentKotlinOptions ? '//' : ''}jvmTarget = $jvmTarget + ${commentKotlinOptions ? '//' : ''}jvmTarget = $kotlinJvmTarget ${commentKotlinOptions ? '//' : ''}}'''; buildGradle.writeAsStringSync(''' @@ -391,6 +394,84 @@ dependencies { ); }); + test('fails when sourceCompatibility/targetCompatibility are below minimum', + () async { + final RepositoryPackage package = + createFakePlugin('a_plugin', packagesDir, examples: []); + writeFakePluginBuildGradle(package, + includeSourceCompat: true, + includeTargetCompat: true, + jvmTargetValue: 11); + writeFakeManifest(package); + + Error? commandError; + final List output = await runCapturingPrint( + runner, ['gradle-check'], errorHandler: (Error e) { + commandError = e; + }); + + expect(commandError, isA()); + expect( + output, + containsAllInOrder([ + contains( + 'Which is below the minimum required. Use at least "JavaVersion.VERSION_'), + ]), + ); + }); + + test('fails when compatibility values do not match kotlinOptions', () async { + final RepositoryPackage package = + createFakePlugin('a_plugin', packagesDir, examples: []); + writeFakePluginBuildGradle( + package, + includeSourceCompat: true, + includeTargetCompat: true, + jvmTargetValue: 21, + // ignore: avoid_redundant_argument_values + kotlinJvmValue: 17, + ); + writeFakeManifest(package); + + Error? commandError; + final List output = await runCapturingPrint( + runner, ['gradle-check'], errorHandler: (Error e) { + commandError = e; + }); + + expect(commandError, isA()); + expect( + output, + containsAllInOrder([ + contains( + 'If build.gradle(.kts) uses JavaVersion.* versions must be the same.'), + ]), + ); + }); + + test('passes when jvmValues are higher than minimim', () async { + final RepositoryPackage package = + createFakePlugin('a_plugin', packagesDir, examples: []); + writeFakePluginBuildGradle( + package, + includeSourceCompat: true, + includeTargetCompat: true, + jvmTargetValue: 21, + kotlinJvmValue: 21, + ); + writeFakeManifest(package); + + final List output = + await runCapturingPrint(runner, ['gradle-check']); + + expect( + output, + containsAllInOrder([ + contains('Validating android/build.gradle'), + ]), + ); + }); + test('passes when sourceCompatibility and targetCompatibility are specified', () async { final RepositoryPackage package = @@ -1242,7 +1323,7 @@ dependencies { writeFakePluginBuildGradle( package, includeLanguageVersion: true, - useDeprecatedJvmTarget: true, + useDeprecatedJvmTargetStyle: true, ); writeFakeManifest(package); From 4385242b4392e33684a1f1a960f99b8b14f2d08d Mon Sep 17 00:00:00 2001 From: Reid Baker <1063596+reidbaker@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:32:27 -0400 Subject: [PATCH 11/14] Update CHANGELOG.md --- packages/interactive_media_ads/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index 6d9dc42c672..312e8fc0522 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -9,6 +9,7 @@ enabled won't build with the current or future IMA versions. To enable app desugaring, see `README.md`. * **Breaking Change** Updates `AdsRequest.adTagUrl` to return `null` when an ad tag is not set. + ## 0.2.8+1 * Resolves Gradle 9 deprecations. From 375b40551eaa49ecc0e9522dea9a61adeffb5b59 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 21 Oct 2025 10:44:35 -0400 Subject: [PATCH 12/14] break out evalutations into their own methods --- script/tool/lib/src/gradle_check_command.dart | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/script/tool/lib/src/gradle_check_command.dart b/script/tool/lib/src/gradle_check_command.dart index fd993db06bd..1aa2533f97e 100644 --- a/script/tool/lib/src/gradle_check_command.dart +++ b/script/tool/lib/src/gradle_check_command.dart @@ -27,6 +27,8 @@ class GradleCheckCommand extends PackageLoopingCommand { super.gitDir, }); + static const int _minimumJavaVersion = 17; + @override final String name = 'gradle-check'; @@ -130,6 +132,12 @@ class GradleCheckCommand extends PackageLoopingCommand { if (!_validateCompatibilityVersions(lines)) { succeeded = false; } + if (!_validateKotlinJvmCompatibility(lines)) { + succeeded = false; + } + if (!_validateJavaKotlinCompileOptionsAlignment(lines)) { + succeeded = false; + } if (!_validateGradleDrivenLintConfig(package, lines)) { succeeded = false; } @@ -356,7 +364,6 @@ build.gradle "namespace" must match the "package" attribute in AndroidManifest.x /// than using whatever the client's local toolchaing defaults to (which can /// lead to compile errors that show up for clients, but not in CI). bool _validateCompatibilityVersions(List gradleLines) { - const int minimumJavaVersion = 17; final bool hasLanguageVersion = gradleLines.any((String line) => line.contains('languageVersion') && !_isCommented(line)); final bool hasCompabilityVersions = gradleLines.any((String line) => @@ -377,15 +384,15 @@ build.gradle(.kts) must set an explicit Java compatibility version. This can be done either via "sourceCompatibility"/"targetCompatibility": android { compileOptions { - sourceCompatibility = JavaVersion.VERSION_$minimumJavaVersion - targetCompatibility = JavaVersion.VERSION_$minimumJavaVersion + sourceCompatibility = JavaVersion.VERSION_$_minimumJavaVersion + targetCompatibility = JavaVersion.VERSION_$_minimumJavaVersion } } or "toolchain": java { toolchain { - languageVersion = JavaLanguageVersion.of($minimumJavaVersion) + languageVersion = JavaLanguageVersion.of($_minimumJavaVersion) } } @@ -397,6 +404,11 @@ for more details.'''; '$indentation${javaErrorMessage.split('\n').join('\n$indentation')}'); return false; } + + return true; + } + + bool _validateKotlinJvmCompatibility(List gradleLines) { bool isKotlinOptions(String line) => line.contains('kotlinOptions') && !_isCommented(line); final bool hasKotlinOptions = gradleLines.any(isKotlinOptions); @@ -419,7 +431,7 @@ If build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax. Good: android { kotlinOptions { - jvmTarget = JavaVersion.VERSION_$minimumJavaVersion.toString() + jvmTarget = JavaVersion.VERSION_$_minimumJavaVersion.toString() } } BAD: @@ -429,7 +441,11 @@ If build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax. '$indentation${kotlinErrorMessage.split('\n').join('\n$indentation')}'); return false; } + // No error condition. + return true; + } + bool _validateJavaKotlinCompileOptionsAlignment(List gradleLines) { final List javaVersions = []; // Some java versions have the format VERSION_1_8 but we dont need to handle those // because they are below the minimum. @@ -446,10 +462,10 @@ If build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax. } if (javaVersions.isNotEmpty) { final int version = int.parse(javaVersions.first); - if (version < minimumJavaVersion) { + if (version < _minimumJavaVersion) { final String minimumJavaVersionError = ''' build.gradle(.kts) uses "JavaVersion.VERSION_$version". -Which is below the minimum required. Use at least "JavaVersion.VERSION_$minimumJavaVersion". +Which is below the minimum required. Use at least "JavaVersion.VERSION_$_minimumJavaVersion". '''; printError( '$indentation${minimumJavaVersionError.split('\n').join('\n$indentation')}'); From 19bc5583e9d182ba8d97a14b47763c7e24f6e4c3 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 21 Oct 2025 10:45:47 -0400 Subject: [PATCH 13/14] validate alignment first --- script/tool/lib/src/gradle_check_command.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/tool/lib/src/gradle_check_command.dart b/script/tool/lib/src/gradle_check_command.dart index 1aa2533f97e..d273c2ee991 100644 --- a/script/tool/lib/src/gradle_check_command.dart +++ b/script/tool/lib/src/gradle_check_command.dart @@ -126,6 +126,9 @@ class GradleCheckCommand extends PackageLoopingCommand { // This is tracked as a variable rather than a sequence of &&s so that all // failures are reported at once, not just the first one. bool succeeded = true; + if (!_validateJavaKotlinCompileOptionsAlignment(lines)) { + succeeded = false; + } if (!_validateNamespace(package, contents, isExample: false)) { succeeded = false; } @@ -135,9 +138,6 @@ class GradleCheckCommand extends PackageLoopingCommand { if (!_validateKotlinJvmCompatibility(lines)) { succeeded = false; } - if (!_validateJavaKotlinCompileOptionsAlignment(lines)) { - succeeded = false; - } if (!_validateGradleDrivenLintConfig(package, lines)) { succeeded = false; } From f2ca6232c7e47be191e6f692078aeebc0d95e7cc Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 21 Oct 2025 11:36:09 -0400 Subject: [PATCH 14/14] Change the order of alignment vs value tests --- script/tool/lib/src/gradle_check_command.dart | 23 ++++++++++--------- .../tool/test/gradle_check_command_test.dart | 11 +++++---- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/script/tool/lib/src/gradle_check_command.dart b/script/tool/lib/src/gradle_check_command.dart index d273c2ee991..1c45a597ba0 100644 --- a/script/tool/lib/src/gradle_check_command.dart +++ b/script/tool/lib/src/gradle_check_command.dart @@ -126,9 +126,6 @@ class GradleCheckCommand extends PackageLoopingCommand { // This is tracked as a variable rather than a sequence of &&s so that all // failures are reported at once, not just the first one. bool succeeded = true; - if (!_validateJavaKotlinCompileOptionsAlignment(lines)) { - succeeded = false; - } if (!_validateNamespace(package, contents, isExample: false)) { succeeded = false; } @@ -138,6 +135,9 @@ class GradleCheckCommand extends PackageLoopingCommand { if (!_validateKotlinJvmCompatibility(lines)) { succeeded = false; } + if (!_validateJavaKotlinCompileOptionsAlignment(lines)) { + succeeded = false; + } if (!_validateGradleDrivenLintConfig(package, lines)) { succeeded = false; } @@ -462,6 +462,15 @@ If build.gradle(.kts) sets jvmTarget then it must use JavaVersion syntax. } if (javaVersions.isNotEmpty) { final int version = int.parse(javaVersions.first); + if (!javaVersions.every((String element) => element == '$version')) { + const String javaVersionAlignmentError = ''' +If build.gradle(.kts) uses JavaVersion.* versions must be the same. +'''; + printError( + '$indentation${javaVersionAlignmentError.split('\n').join('\n$indentation')}'); + return false; + } + if (version < _minimumJavaVersion) { final String minimumJavaVersionError = ''' build.gradle(.kts) uses "JavaVersion.VERSION_$version". @@ -471,14 +480,6 @@ Which is below the minimum required. Use at least "JavaVersion.VERSION_$_minimum '$indentation${minimumJavaVersionError.split('\n').join('\n$indentation')}'); return false; } - if (!javaVersions.every((String element) => element == '$version')) { - const String javaVersionAlignmentError = ''' -If build.gradle(.kts) uses JavaVersion.* versions must be the same. -'''; - printError( - '$indentation${javaVersionAlignmentError.split('\n').join('\n$indentation')}'); - return false; - } } return true; diff --git a/script/tool/test/gradle_check_command_test.dart b/script/tool/test/gradle_check_command_test.dart index 7198a162ed0..0637f922649 100644 --- a/script/tool/test/gradle_check_command_test.dart +++ b/script/tool/test/gradle_check_command_test.dart @@ -398,10 +398,13 @@ dependencies { () async { final RepositoryPackage package = createFakePlugin('a_plugin', packagesDir, examples: []); - writeFakePluginBuildGradle(package, - includeSourceCompat: true, - includeTargetCompat: true, - jvmTargetValue: 11); + writeFakePluginBuildGradle( + package, + includeSourceCompat: true, + includeTargetCompat: true, + jvmTargetValue: 11, + kotlinJvmValue: 11, + ); writeFakeManifest(package); Error? commandError;