diff --git a/.agents/skills/README.md b/.agents/skills/README.md new file mode 100644 index 000000000000..38e778826a20 --- /dev/null +++ b/.agents/skills/README.md @@ -0,0 +1,12 @@ +# Flutter Agent Skills + +Welcome to the `.agent/skills` directory. This directory contains agent skills designed for consumption by Flutter package contributors. + +## Base guidance + +flutter/packages follows the same guidance that flutter/flutter uses. +https://github.com/flutter/flutter/blob/master/.agents/skills/README.md + +## Packages specific guidance + +When there is specific guidance for packages it will go here. diff --git a/.ci/flutter_master.version b/.ci/flutter_master.version index 9125739e0120..59d0f6d9a647 100644 --- a/.ci/flutter_master.version +++ b/.ci/flutter_master.version @@ -1 +1 @@ -0f401eea04390dc08eb939b6c0fee17c7d15f6ec +bf18e3958a05cd8cc098d4bfcbe9163d596cf3af diff --git a/.claude/skills b/.claude/skills new file mode 120000 index 000000000000..501823006312 --- /dev/null +++ b/.claude/skills @@ -0,0 +1 @@ +.agents/skills \ No newline at end of file diff --git a/.direnv b/.direnv new file mode 100644 index 000000000000..e476d88bcf02 --- /dev/null +++ b/.direnv @@ -0,0 +1 @@ +source_up_if_exists diff --git a/.github/remove_cicd.yml b/.github/workflows/remove_cicd.yml similarity index 100% rename from .github/remove_cicd.yml rename to .github/workflows/remove_cicd.yml diff --git a/.github/workflows/sync_release_pr.yml b/.github/workflows/sync_release_pr.yml index 2b5ce6a84036..0280893b0708 100644 --- a/.github/workflows/sync_release_pr.yml +++ b/.github/workflows/sync_release_pr.yml @@ -41,4 +41,4 @@ jobs: --head "${{ github.ref_name }}" \ --title "Sync ${{ github.ref_name }} to main" \ --body "This automated PR syncs the changes from the release branch ${{ github.ref_name }} back to the main branch." \ - --label "post-${{ github.ref_name }}" + --label "override: post-${{ github.ref_name }}" diff --git a/.gitignore b/.gitignore index c9dae8e685c2..bb526c9628d5 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,10 @@ xcuserdata/ generated_plugin_registrant.* GeneratedPluginRegistrant.* +# These should be ephemeral, but currently aren't, so ignore them. See: +# - https://github.com/flutter/flutter/issues/149917 +# - https://github.com/flutter/flutter/issues/76726 +**/generated_plugins.cmake # Gradle **/gradle-wrapper.jar diff --git a/agent-artifacts/.gitignore b/agent-artifacts/.gitignore new file mode 100644 index 000000000000..7c9d611b5924 --- /dev/null +++ b/agent-artifacts/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!README.md diff --git a/agent-artifacts/README.md b/agent-artifacts/README.md new file mode 100644 index 000000000000..d49b5ea62457 --- /dev/null +++ b/agent-artifacts/README.md @@ -0,0 +1,4 @@ +# Agent Artifacts + +This directory is intended for agents and skills to store files that should not be tracked by git. +Files in this directory (with the exception of `.gitignore` and `README.md`) are ignored by version control. diff --git a/packages/camera/camera/example/android/app/build.gradle b/packages/camera/camera/example/android/app/build.gradle deleted file mode 100644 index 080f8244bad9..000000000000 --- a/packages/camera/camera/example/android/app/build.gradle +++ /dev/null @@ -1,63 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.cameraexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.cameraexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - profile { - matchingFallbacks = ['debug', 'release'] - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test:rules:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") -} diff --git a/packages/camera/camera/example/android/app/build.gradle.kts b/packages/camera/camera/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..abcd449ee17f --- /dev/null +++ b/packages/camera/camera/example/android/app/build.gradle.kts @@ -0,0 +1,51 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.cameraexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.cameraexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + getByName("profile") { + matchingFallbacks.addAll(listOf("debug", "release")) + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test:rules:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") +} diff --git a/packages/camera/camera/example/android/build.gradle b/packages/camera/camera/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/camera/camera/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/camera/camera/example/android/build.gradle.kts b/packages/camera/camera/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/camera/camera/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/camera/camera/example/android/settings.gradle b/packages/camera/camera/example/android/settings.gradle deleted file mode 100644 index d7ba8d54ffbc..000000000000 --- a/packages/camera/camera/example/android/settings.gradle +++ /dev/null @@ -1,28 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" - -} - -include ":app" diff --git a/packages/camera/camera/example/android/settings.gradle.kts b/packages/camera/camera/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/camera/camera/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/camera/camera_android/example/android/app/build.gradle b/packages/camera/camera_android/example/android/app/build.gradle deleted file mode 100644 index 080f8244bad9..000000000000 --- a/packages/camera/camera_android/example/android/app/build.gradle +++ /dev/null @@ -1,63 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.cameraexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.cameraexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - profile { - matchingFallbacks = ['debug', 'release'] - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test:rules:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") -} diff --git a/packages/camera/camera_android/example/android/app/build.gradle.kts b/packages/camera/camera_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..5cbd95299a93 --- /dev/null +++ b/packages/camera/camera_android/example/android/app/build.gradle.kts @@ -0,0 +1,51 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.cameraexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.cameraexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + getByName("profile") { + matchingFallbacks += listOf("debug", "release") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test:rules:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") +} diff --git a/packages/camera/camera_android/example/android/build.gradle b/packages/camera/camera_android/example/android/build.gradle deleted file mode 100644 index 0e991044a094..000000000000 --- a/packages/camera/camera_android/example/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":camera_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/camera/camera_android/example/android/build.gradle.kts b/packages/camera/camera_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..75c21ddbb6b5 --- /dev/null +++ b/packages/camera/camera_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":camera_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/camera/camera_android/example/android/settings.gradle b/packages/camera/camera_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/camera/camera_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/camera/camera_android/example/android/settings.gradle.kts b/packages/camera/camera_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/camera/camera_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/camera/camera_android_camerax/example/android/app/build.gradle b/packages/camera/camera_android_camerax/example/android/app/build.gradle deleted file mode 100644 index c622ae4f9dea..000000000000 --- a/packages/camera/camera_android_camerax/example/android/app/build.gradle +++ /dev/null @@ -1,67 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.cameraxexample" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - kotlinOptions { - // This must match the Java version provided in compileOptions. - jvmTarget = JavaVersion.VERSION_17.toString() - } - - defaultConfig { - applicationId "io.flutter.plugins.cameraxexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/camera/camera_android_camerax/example/android/app/build.gradle.kts b/packages/camera/camera_android_camerax/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..34eeda4f747e --- /dev/null +++ b/packages/camera/camera_android_camerax/example/android/app/build.gradle.kts @@ -0,0 +1,46 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.cameraxexample" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.cameraxexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/camera/camera_android_camerax/example/android/build.gradle b/packages/camera/camera_android_camerax/example/android/build.gradle deleted file mode 100644 index 76edbf940bb0..000000000000 --- a/packages/camera/camera_android_camerax/example/android/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":camera_android_camerax") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/camera/camera_android_camerax/example/android/build.gradle.kts b/packages/camera/camera_android_camerax/example/android/build.gradle.kts new file mode 100644 index 000000000000..5cd4e03b613a --- /dev/null +++ b/packages/camera/camera_android_camerax/example/android/build.gradle.kts @@ -0,0 +1,46 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} + +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":camera_android_camerax") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/camera/camera_android_camerax/example/android/settings.gradle b/packages/camera/camera_android_camerax/example/android/settings.gradle deleted file mode 100644 index b83203f03197..000000000000 --- a/packages/camera/camera_android_camerax/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/camera/camera_android_camerax/example/android/settings.gradle.kts b/packages/camera/camera_android_camerax/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/camera/camera_android_camerax/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/camera/camera_windows/example/windows/flutter/generated_plugins.cmake b/packages/camera/camera_windows/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 458d22dac410..000000000000 --- a/packages/camera/camera_windows/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - camera_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/espresso/example/android/app/build.gradle b/packages/espresso/example/android/app/build.gradle.kts similarity index 56% rename from packages/espresso/example/android/app/build.gradle rename to packages/espresso/example/android/app/build.gradle.kts index 21e82d2a4ef3..bd4a4767ae50 100644 --- a/packages/espresso/example/android/app/build.gradle +++ b/packages/espresso/example/android/app/build.gradle.kts @@ -1,55 +1,42 @@ plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") } android { - compileSdk = flutter.compileSdkVersion - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). namespace = "com.example.espresso_example" + compileSdk = flutter.compileSdkVersion + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } defaultConfig { - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug + signingConfig = signingConfigs.getByName("debug") } } lint { - disable 'InvalidPackage' + disable.add("InvalidPackage") } } flutter { - source = '../..' + source = "../.." } dependencies { diff --git a/packages/espresso/example/android/build.gradle b/packages/espresso/example/android/build.gradle deleted file mode 100644 index 31e331a7ec51..000000000000 --- a/packages/espresso/example/android/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":espresso") { - tasks.withType(JavaCompile) { - // Ignore classfile warnings due to https://bugs.openjdk.org/browse/JDK-8190452 - // TODO(stuartmorgan): Remove that ignore once the build uses Java 11+. - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/espresso/example/android/build.gradle.kts b/packages/espresso/example/android/build.gradle.kts new file mode 100644 index 000000000000..0a08188ee915 --- /dev/null +++ b/packages/espresso/example/android/build.gradle.kts @@ -0,0 +1,46 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} + +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":espresso") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/espresso/example/android/settings.gradle b/packages/espresso/example/android/settings.gradle deleted file mode 100644 index d7ba8d54ffbc..000000000000 --- a/packages/espresso/example/android/settings.gradle +++ /dev/null @@ -1,28 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" - -} - -include ":app" diff --git a/packages/espresso/example/android/settings.gradle.kts b/packages/espresso/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/espresso/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/file_selector/file_selector/example/android/app/build.gradle b/packages/file_selector/file_selector/example/android/app/build.gradle deleted file mode 100644 index 272243c1d34d..000000000000 --- a/packages/file_selector/file_selector/example/android/app/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "dev.flutter.plugins.file_selector_example" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - applicationId "dev.flutter.plugins.file_selector_example" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} diff --git a/packages/file_selector/file_selector/example/android/app/build.gradle.kts b/packages/file_selector/file_selector/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..b5738ce6f126 --- /dev/null +++ b/packages/file_selector/file_selector/example/android/app/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "dev.flutter.plugins.file_selector_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "dev.flutter.plugins.file_selector_example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/packages/file_selector/file_selector/example/android/build.gradle b/packages/file_selector/file_selector/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/file_selector/file_selector/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/file_selector/file_selector/example/android/build.gradle.kts b/packages/file_selector/file_selector/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/file_selector/file_selector/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/file_selector/file_selector/example/android/settings.gradle b/packages/file_selector/file_selector/example/android/settings.gradle deleted file mode 100644 index b83203f03197..000000000000 --- a/packages/file_selector/file_selector/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/file_selector/file_selector/example/android/settings.gradle.kts b/packages/file_selector/file_selector/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/file_selector/file_selector/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/file_selector/file_selector/example/linux/flutter/generated_plugins.cmake b/packages/file_selector/file_selector/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2db3c22ae228..000000000000 --- a/packages/file_selector/file_selector/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/file_selector/file_selector/example/windows/flutter/generated_plugins.cmake b/packages/file_selector/file_selector/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index a423a02476a2..000000000000 --- a/packages/file_selector/file_selector/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/file_selector/file_selector_android/example/android/app/build.gradle b/packages/file_selector/file_selector_android/example/android/app/build.gradle deleted file mode 100644 index 3b2b53354573..000000000000 --- a/packages/file_selector/file_selector_android/example/android/app/build.gradle +++ /dev/null @@ -1,66 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "dev.flutter.packages.file_selector_android_example" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - defaultConfig { - applicationId "dev.flutter.packages.file_selector_android_example" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.espresso:espresso-intents:3.4.0") - androidTestImplementation("androidx.test:runner:1.4.0") - androidTestImplementation("androidx.test:rules:1.4.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") - implementation(project(':file_selector_android')) - implementation(project(':espresso')) - api("androidx.test:core:1.4.0") -} diff --git a/packages/file_selector/file_selector_android/example/android/app/build.gradle.kts b/packages/file_selector/file_selector_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..d687271b70c4 --- /dev/null +++ b/packages/file_selector/file_selector_android/example/android/app/build.gradle.kts @@ -0,0 +1,46 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "dev.flutter.packages.file_selector_android_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + applicationId = "dev.flutter.packages.file_selector_android_example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.espresso:espresso-intents:3.4.0") + androidTestImplementation("androidx.test:runner:1.4.0") + androidTestImplementation("androidx.test:rules:1.4.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + implementation(project(":file_selector_android")) + implementation(project(":espresso")) + api("androidx.test:core:1.4.0") +} diff --git a/packages/file_selector/file_selector_android/example/android/build.gradle b/packages/file_selector/file_selector_android/example/android/build.gradle deleted file mode 100644 index 0794404e2f24..000000000000 --- a/packages/file_selector/file_selector_android/example/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":file_selector_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/file_selector/file_selector_android/example/android/build.gradle.kts b/packages/file_selector/file_selector_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..eff9450a812e --- /dev/null +++ b/packages/file_selector/file_selector_android/example/android/build.gradle.kts @@ -0,0 +1,49 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":file_selector_android") { + // Workaround for a warning when building that the above turns into + // an error: + // Cannot find annotation method 'api()' in type 'RequiresApi': class + // file for android.annotation.RequiresApi not found + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror", "-Xlint:-classfile")) + } + } +} diff --git a/packages/file_selector/file_selector_android/example/android/settings.gradle b/packages/file_selector/file_selector_android/example/android/settings.gradle deleted file mode 100644 index b83203f03197..000000000000 --- a/packages/file_selector/file_selector_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/file_selector/file_selector_android/example/android/settings.gradle.kts b/packages/file_selector/file_selector_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/file_selector/file_selector_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/file_selector/file_selector_linux/example/linux/flutter/generated_plugins.cmake b/packages/file_selector/file_selector_linux/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2db3c22ae228..000000000000 --- a/packages/file_selector/file_selector_linux/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/file_selector/file_selector_windows/example/windows/flutter/generated_plugins.cmake b/packages/file_selector/file_selector_windows/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index a423a02476a2..000000000000 --- a/packages/file_selector/file_selector_windows/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/flutter_plugin_android_lifecycle/example/android/app/build.gradle b/packages/flutter_plugin_android_lifecycle/example/android/app/build.gradle deleted file mode 100644 index f8389c7bd30a..000000000000 --- a/packages/flutter_plugin_android_lifecycle/example/android/app/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - - -android { - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "io.flutter.plugins.flutter_plugin_android_lifecycle_example" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - namespace = "io.flutter.plugins.flutter_plugin_android_lifecycle_example" - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/flutter_plugin_android_lifecycle/example/android/app/build.gradle.kts b/packages/flutter_plugin_android_lifecycle/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..0ee0ce2f9fdd --- /dev/null +++ b/packages/flutter_plugin_android_lifecycle/example/android/app/build.gradle.kts @@ -0,0 +1,47 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.flutter_plugin_android_lifecycle_example" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.flutter_plugin_android_lifecycle_example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.1.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") +} diff --git a/packages/flutter_plugin_android_lifecycle/example/android/build.gradle b/packages/flutter_plugin_android_lifecycle/example/android/build.gradle deleted file mode 100644 index 39fed5c8ebbb..000000000000 --- a/packages/flutter_plugin_android_lifecycle/example/android/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":flutter_plugin_android_lifecycle") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/flutter_plugin_android_lifecycle/example/android/build.gradle.kts b/packages/flutter_plugin_android_lifecycle/example/android/build.gradle.kts new file mode 100644 index 000000000000..a1f852bec044 --- /dev/null +++ b/packages/flutter_plugin_android_lifecycle/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":flutter_plugin_android_lifecycle") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/flutter_plugin_android_lifecycle/example/android/settings.gradle b/packages/flutter_plugin_android_lifecycle/example/android/settings.gradle deleted file mode 100644 index 3880f232841c..000000000000 --- a/packages/flutter_plugin_android_lifecycle/example/android/settings.gradle +++ /dev/null @@ -1,38 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -buildscript { - repositories { - maven { - url = "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "gradle.plugin.com.google.cloud.artifactregistry:artifactregistry-gradle-plugin:2.2.1" - } -} - -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/flutter_plugin_android_lifecycle/example/android/settings.gradle.kts b/packages/flutter_plugin_android_lifecycle/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/flutter_plugin_android_lifecycle/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index d285020e0c71..515b93302174 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -1,3 +1,8 @@ +## 17.2.1 + +- Fixes chained top-level redirects not being fully resolved (e.g. `/ → /a → /b` stopping at `/a`). +- Fixes route-level redirects not triggering top-level redirect re-evaluation on the new location. + ## 17.2.0 - Fixes `Block.then()` and `Allow.then()` navigation callbacks being silently lost when triggered by `refreshListenable` due to re-entrant route processing. diff --git a/packages/go_router/lib/src/configuration.dart b/packages/go_router/lib/src/configuration.dart index ef408b442708..e78011f6aa16 100644 --- a/packages/go_router/lib/src/configuration.dart +++ b/packages/go_router/lib/src/configuration.dart @@ -249,7 +249,7 @@ class RouteConfiguration { /// Legacy top level page redirect. /// - /// This is handled via [applyTopLegacyRedirect] and runs at most once per navigation. + /// This is handled via [applyTopLegacyRedirect] inside [redirect]. GoRouterRedirect get topRedirect => _routingConfig.value.redirect; /// Top level page on enter. @@ -401,80 +401,121 @@ class RouteConfiguration { return const []; } - /// Processes route-level redirects by returning a new [RouteMatchList] representing the new location. + /// Processes all redirects (top-level and route-level) and returns the + /// final [RouteMatchList]. /// - /// This method now handles ONLY route-level redirects. - /// Top-level redirects are handled by applyTopLegacyRedirect. + /// Top-level redirects are evaluated first via [applyTopLegacyRedirect], + /// then route-level redirects run on the resulting match list. If a + /// route-level redirect changes the location, this method recurses — + /// re-evaluating top-level redirects on the new location naturally. FutureOr redirect( BuildContext context, FutureOr prevMatchListFuture, { required List redirectHistory, }) { FutureOr processRedirect(RouteMatchList prevMatchList) { - final prevLocation = prevMatchList.uri.toString(); - - FutureOr processRouteLevelRedirect( - String? routeRedirectLocation, - ) { - if (routeRedirectLocation != null && - routeRedirectLocation != prevLocation) { - final RouteMatchList newMatch = _getNewMatches( - routeRedirectLocation, - prevMatchList.uri, - redirectHistory, - ); + // Step 1: Apply top-level redirect first (self-recursive for chains). + final FutureOr afterTopLevel = applyTopLegacyRedirect( + context, + prevMatchList, + redirectHistory: redirectHistory, + ); - if (newMatch.isError) { - return newMatch; - } - return redirect(context, newMatch, redirectHistory: redirectHistory); - } - return prevMatchList; + // Step 2: Then apply route-level redirects on the post-top-level result. + if (afterTopLevel is RouteMatchList) { + return _processRouteLevelRedirects( + context, + afterTopLevel, + redirectHistory, + ); } - - final routeMatches = []; - prevMatchList.visitRouteMatches((RouteMatchBase match) { - if (match.route.redirect != null) { - routeMatches.add(match); + return afterTopLevel.then((RouteMatchList ml) { + if (!context.mounted) { + return ml; } - return true; + return _processRouteLevelRedirects(context, ml, redirectHistory); }); + } + + if (prevMatchListFuture is RouteMatchList) { + return processRedirect(prevMatchListFuture); + } + return prevMatchListFuture.then(processRedirect); + } - try { - final FutureOr routeLevelRedirectResult = - _getRouteLevelRedirect(context, prevMatchList, routeMatches, 0); + /// Processes route-level redirects on [matchList]. + /// + /// If a route-level redirect changes the location, recurses back into + /// [redirect] which will re-evaluate top-level redirects on the new path. + FutureOr _processRouteLevelRedirects( + BuildContext context, + RouteMatchList matchList, + List redirectHistory, + ) { + final prevLocation = matchList.uri.toString(); - if (routeLevelRedirectResult is String?) { - return processRouteLevelRedirect(routeLevelRedirectResult); - } - return routeLevelRedirectResult - .then(processRouteLevelRedirect) - .catchError((Object error) { - final GoException goException = error is GoException - ? error - : GoException('Exception during route redirect: $error'); - return _errorRouteMatchList( - prevMatchList.uri, - goException, - extra: prevMatchList.extra, - ); - }); - } catch (exception) { - final GoException goException = exception is GoException - ? exception - : GoException('Exception during route redirect: $exception'); - return _errorRouteMatchList( - prevMatchList.uri, - goException, - extra: prevMatchList.extra, + FutureOr processRouteLevelRedirect( + String? routeRedirectLocation, + ) { + if (routeRedirectLocation != null && + routeRedirectLocation != prevLocation) { + final RouteMatchList newMatch = _getNewMatches( + routeRedirectLocation, + matchList.uri, + redirectHistory, ); + + if (newMatch.isError) { + return newMatch; + } + // Recurse into redirect — top-level will be re-evaluated at the + // top of the next cycle. + return redirect(context, newMatch, redirectHistory: redirectHistory); } + return matchList; } - if (prevMatchListFuture is RouteMatchList) { - return processRedirect(prevMatchListFuture); + final routeMatches = []; + matchList.visitRouteMatches((RouteMatchBase match) { + if (match.route.redirect != null) { + routeMatches.add(match); + } + return true; + }); + + try { + final FutureOr routeLevelRedirectResult = _getRouteLevelRedirect( + context, + matchList, + routeMatches, + 0, + ); + + if (routeLevelRedirectResult is String?) { + return processRouteLevelRedirect(routeLevelRedirectResult); + } + return routeLevelRedirectResult + .then(processRouteLevelRedirect) + .catchError((Object error) { + final GoException goException = error is GoException + ? error + : GoException('Exception during route redirect: $error'); + return _errorRouteMatchList( + matchList.uri, + goException, + extra: matchList.extra, + ); + }); + } catch (exception) { + final GoException goException = exception is GoException + ? exception + : GoException('Exception during route redirect: $exception'); + return _errorRouteMatchList( + matchList.uri, + goException, + extra: matchList.extra, + ); } - return prevMatchListFuture.then(processRedirect); } /// Applies the legacy top-level redirect to [prevMatchList] and returns the @@ -484,9 +525,10 @@ class RouteConfiguration { /// /// Shares [redirectHistory] with later route-level redirects for proper loop detection. /// - /// Note: Legacy top-level redirect is executed at most once per navigation, - /// before route-level redirects. It does not re-evaluate if it redirects to - /// a location that would itself trigger another top-level redirect. + /// Recursively re-evaluates the top-level redirect when it produces a new + /// location, so that top-level redirect chains (e.g. `/` → `/a` → `/b`) are + /// fully resolved. Loop detection and redirect limit are enforced via the + /// shared [redirectHistory]. FutureOr applyTopLegacyRedirect( BuildContext context, RouteMatchList prevMatchList, { @@ -500,7 +542,15 @@ class RouteConfiguration { prevMatchList.uri, redirectHistory, ); - return newMatch; + if (newMatch.isError) { + return newMatch; + } + // Recursively re-evaluate the top-level redirect on the new location. + return applyTopLegacyRedirect( + context, + newMatch, + redirectHistory: redirectHistory, + ); } return prevMatchList; } diff --git a/packages/go_router/lib/src/parser.dart b/packages/go_router/lib/src/parser.dart index c900b02d8570..5b91b0e81ff9 100644 --- a/packages/go_router/lib/src/parser.dart +++ b/packages/go_router/lib/src/parser.dart @@ -111,54 +111,22 @@ class GoRouteInformationParser extends RouteInformationParser { ); // ALL navigation types now go through onEnter, and if allowed, - // legacy top-level redirect runs, then route-level redirects. + // redirect() handles both top-level and route-level redirects. return _onEnterHandler.handleTopOnEnter( context: context, routeInformation: effectiveRoute, infoState: infoState, onCanEnter: () { - // Compose legacy top-level redirect here (one shared cycle/history). final RouteMatchList initialMatches = configuration.findMatch( effectiveRoute.uri, extra: infoState.extra, ); - final redirectHistory = []; - - final FutureOr afterLegacy = configuration - .applyTopLegacyRedirect( - context, - initialMatches, - redirectHistory: redirectHistory, - ); - - if (afterLegacy is RouteMatchList) { - return _navigate( - effectiveRoute, - context, - infoState, - startingMatches: afterLegacy, - preSharedHistory: redirectHistory, - ); - } - return afterLegacy.then((RouteMatchList ml) { - if (!context.mounted) { - return _lastMatchList ?? - _OnEnterHandler._errorRouteMatchList( - effectiveRoute.uri, - GoException( - 'Navigation aborted because the router context was disposed.', - ), - extra: infoState.extra, - ); - } - return _navigate( - effectiveRoute, - context, - infoState, - startingMatches: ml, - preSharedHistory: redirectHistory, - ); - }); + return _navigate( + effectiveRoute, + context, + infoState, + startingMatches: initialMatches, + ); }, onCanNotEnter: () { // If blocked, stay on the current route by restoring the last known good configuration. @@ -198,7 +166,6 @@ class GoRouteInformationParser extends RouteInformationParser { BuildContext context, RouteInfoState infoState, { FutureOr? startingMatches, - List? preSharedHistory, }) { // If we weren't given matches, compute them here. The URI has already been // normalized at the parser entry point. @@ -206,11 +173,10 @@ class GoRouteInformationParser extends RouteInformationParser { startingMatches ?? configuration.findMatch(routeInformation.uri, extra: infoState.extra); - // History may be shared with the legacy step done in onEnter. - final List redirectHistory = - preSharedHistory ?? []; + final redirectHistory = []; - FutureOr afterRouteLevel(FutureOr base) { + // redirect() handles both top-level and route-level redirects. + FutureOr applyRedirects(FutureOr base) { if (base is RouteMatchList) { return configuration.redirect( context, @@ -222,27 +188,33 @@ class GoRouteInformationParser extends RouteInformationParser { if (!context.mounted) { return ml; } - final FutureOr step = configuration.redirect( + return configuration.redirect( context, ml, redirectHistory: redirectHistory, ); - return step; }); } - // Only route-level redirects from here on out. - final FutureOr redirected = afterRouteLevel(baseMatches); + final FutureOr redirected = applyRedirects(baseMatches); return debugParserFuture = (redirected is RouteMatchList ? SynchronousFuture(redirected) : redirected) .then((RouteMatchList matchList) { + // Guard against context disposal during async redirects. + if (!context.mounted) { + return _lastMatchList ?? + _OnEnterHandler._errorRouteMatchList( + routeInformation.uri, + GoException( + 'Navigation aborted because the router context was disposed.', + ), + extra: infoState.extra, + ); + } if (matchList.isError && onParserException != null) { - if (!context.mounted) { - return matchList; - } return onParserException!(context, matchList); } diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml index a397f17cf850..0f0bde31e55d 100644 --- a/packages/go_router/pubspec.yaml +++ b/packages/go_router/pubspec.yaml @@ -1,7 +1,7 @@ name: go_router description: A declarative router for Flutter based on Navigation 2 supporting deep linking, data-driven routes and more -version: 17.2.0 +version: 17.2.1 repository: https://github.com/flutter/packages/tree/main/packages/go_router issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22 diff --git a/packages/go_router/test/on_enter_test.dart b/packages/go_router/test/on_enter_test.dart index c9408ea4183d..2fb09cc051f3 100644 --- a/packages/go_router/test/on_enter_test.dart +++ b/packages/go_router/test/on_enter_test.dart @@ -1848,5 +1848,176 @@ void main() { }, ); }); + + // Tests for onEnter interaction with chained redirects. + // These validate that onEnter works correctly when top-level and + // route-level redirects produce chains. + group('onEnter with chained redirects', () { + testWidgets('onEnter called once when top-level redirect chains', ( + WidgetTester tester, + ) async { + // Regression test for https://github.com/flutter/flutter/issues/178984 + // + // Top-level redirect: / -> /a -> /b + // onEnter should allow navigation and be called exactly once + // for the final resolved location. + var onEnterCallCount = 0; + var redirectCallCount = 0; + + router = GoRouter( + initialLocation: '/', + onEnter: + ( + BuildContext context, + GoRouterState current, + GoRouterState next, + GoRouter goRouter, + ) async { + onEnterCallCount++; + return const Allow(); + }, + redirect: (BuildContext context, GoRouterState state) { + redirectCallCount++; + if (state.matchedLocation == '/') { + return '/a'; + } + if (state.matchedLocation == '/a') { + return '/b'; + } + return null; + }, + routes: [ + GoRoute(path: '/', builder: (_, __) => const Text('Home')), + GoRoute(path: '/a', builder: (_, __) => const Text('A')), + GoRoute(path: '/b', builder: (_, __) => const Text('B')), + ], + ); + + await tester.pumpWidget(MaterialApp.router(routerConfig: router)); + await tester.pumpAndSettle(); + + // Chain should resolve to /b. + expect(router.routerDelegate.currentConfiguration.uri.toString(), '/b'); + expect(find.text('B'), findsOneWidget); + // onEnter should be called exactly once for the initial navigation. + expect(onEnterCallCount, 1); + // Redirect should be called for /, /a, and /b. + expect(redirectCallCount, 3); + }); + + testWidgets( + 'onEnter called once when route-level triggers top-level redirect', + (WidgetTester tester) async { + // Route-level on /src: /src -> /dst + // Top-level: /dst -> /final + // onEnter should be called exactly once. + var onEnterCallCount = 0; + + router = GoRouter( + initialLocation: '/src', + onEnter: + ( + BuildContext context, + GoRouterState current, + GoRouterState next, + GoRouter goRouter, + ) async { + onEnterCallCount++; + return const Allow(); + }, + redirect: (BuildContext context, GoRouterState state) { + if (state.matchedLocation == '/dst') { + return '/final'; + } + return null; + }, + routes: [ + GoRoute( + path: '/', + builder: (_, __) => const Text('Home'), + routes: [ + GoRoute( + path: 'src', + builder: (_, __) => const Text('Src'), + redirect: (BuildContext context, GoRouterState state) => + '/dst', + ), + ], + ), + GoRoute(path: '/dst', builder: (_, __) => const Text('Dst')), + GoRoute(path: '/final', builder: (_, __) => const Text('Final')), + ], + ); + + await tester.pumpWidget(MaterialApp.router(routerConfig: router)); + await tester.pumpAndSettle(); + + // Chain should resolve to /final. + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/final', + ); + expect(find.text('Final'), findsOneWidget); + // onEnter should be called exactly once for the initial navigation. + expect(onEnterCallCount, 1); + }, + ); + + testWidgets('onEnter block prevents redirect chain evaluation', ( + WidgetTester tester, + ) async { + // onEnter blocks navigation to /a. + // Top-level redirect: /a -> /b (should never be evaluated). + var redirectCallCount = 0; + + router = GoRouter( + initialLocation: '/', + onEnter: + ( + BuildContext context, + GoRouterState current, + GoRouterState next, + GoRouter goRouter, + ) async { + // Block all navigation except to /. + if (next.uri.path == '/') { + return const Allow(); + } + return const Block.stop(); + }, + redirect: (BuildContext context, GoRouterState state) { + redirectCallCount++; + if (state.matchedLocation == '/a') { + return '/b'; + } + return null; + }, + routes: [ + GoRoute(path: '/', builder: (_, __) => const Text('Home')), + GoRoute(path: '/a', builder: (_, __) => const Text('A')), + GoRoute(path: '/b', builder: (_, __) => const Text('B')), + ], + ); + + await tester.pumpWidget(MaterialApp.router(routerConfig: router)); + await tester.pumpAndSettle(); + + // Initial navigation to / is allowed. + expect(find.text('Home'), findsOneWidget); + final redirectCountAfterInit = redirectCallCount; + + // Navigate to /a — should be blocked by onEnter. + router.go('/a'); + await tester.pumpAndSettle(); + + // Navigation was blocked; still on Home. + expect(find.text('Home'), findsOneWidget); + expect(find.text('A'), findsNothing); + expect(find.text('B'), findsNothing); + // Redirect function should NOT have been called for /a since + // onEnter blocked before redirects were evaluated. + expect(redirectCallCount, redirectCountAfterInit); + }); + }); }); } diff --git a/packages/go_router/test/redirect_chain_test.dart b/packages/go_router/test/redirect_chain_test.dart new file mode 100644 index 000000000000..7eee12809189 --- /dev/null +++ b/packages/go_router/test/redirect_chain_test.dart @@ -0,0 +1,882 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:go_router/go_router.dart'; + +import 'test_helpers.dart'; + +// Tests for chained redirect behavior. +// +// These tests validate that top-level redirects are fully re-evaluated +// when they produce a new location, and that route-level redirects +// trigger top-level re-evaluation on the new location. +void main() { + group('chained redirects', () { + testWidgets('top-level redirect chain', (WidgetTester tester) async { + // Regression test for https://github.com/flutter/flutter/issues/178984 + // + // Top-level redirect: / -> /a -> /b + // Expected: navigating to / should end up at /b + final redirectLog = []; + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const Page1Screen(), + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const Page2Screen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + redirectLog.add(state.matchedLocation); + if (state.matchedLocation == '/') { + return '/a'; + } + if (state.matchedLocation == '/a') { + return '/b'; + } + return null; + }, + ); + + expect(router.routerDelegate.currentConfiguration.uri.toString(), '/b'); + expect(find.byType(Page2Screen), findsOneWidget); + // Redirect evaluated for /, /a, and /b. + expect(redirectLog, ['/', '/a', '/b']); + }); + + testWidgets('top-level redirect chain with three hops', ( + WidgetTester tester, + ) async { + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/step1', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/step2', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/step3', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + return switch (state.matchedLocation) { + '/' => '/step1', + '/step1' => '/step2', + '/step2' => '/step3', + _ => null, + }; + }, + ); + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/step3', + ); + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets('async top-level redirect chain', (WidgetTester tester) async { + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) async { + // Simulate an async operation (e.g., checking auth status). + await Future.delayed(Duration.zero); + if (state.matchedLocation == '/') { + return '/a'; + } + if (state.matchedLocation == '/a') { + return '/b'; + } + return null; + }, + ); + + await tester.pumpAndSettle(); + + expect(router.routerDelegate.currentConfiguration.uri.toString(), '/b'); + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets('top-level redirect chain loop detection', ( + WidgetTester tester, + ) async { + // Redirect loop: / -> /a -> /b -> /a (loop) + await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + return switch (state.matchedLocation) { + '/' => '/a', + '/a' => '/b', + '/b' => '/a', // Loop: /a -> /b -> /a + _ => null, + }; + }, + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + + expect(find.byType(TestErrorScreen), findsOneWidget); + final TestErrorScreen screen = tester.widget( + find.byType(TestErrorScreen), + ); + expect( + (screen.ex as GoException).message, + startsWith('redirect loop detected'), + ); + }); + + testWidgets('top-level redirect chain loop to initial location', ( + WidgetTester tester, + ) async { + // Redirect loop returning to initial location: / -> /a -> / + await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + return switch (state.matchedLocation) { + '/' => '/a', + '/a' => '/', // Loop back to initial. + _ => null, + }; + }, + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + + expect(find.byType(TestErrorScreen), findsOneWidget); + final TestErrorScreen screen = tester.widget( + find.byType(TestErrorScreen), + ); + expect( + (screen.ex as GoException).message, + startsWith('redirect loop detected'), + ); + }); + + testWidgets('top-level redirect chain into route-level redirect', ( + WidgetTester tester, + ) async { + // Top-level: / -> /intermediate + // Route-level on /intermediate: /intermediate -> /final + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/intermediate', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + redirect: (BuildContext context, GoRouterState state) => '/final', + ), + GoRoute( + path: '/final', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + if (state.matchedLocation == '/') { + return '/intermediate'; + } + return null; + }, + ); + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/final', + ); + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets('route-level redirect triggers top-level redirect', ( + WidgetTester tester, + ) async { + // Route-level on /src: /src -> /dst + // Top-level: /dst -> /final + final topRedirectLog = []; + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + routes: [ + GoRoute( + path: 'src', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + redirect: (BuildContext context, GoRouterState state) => '/dst', + ), + ], + ), + GoRoute( + path: '/dst', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/final', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + initialLocation: '/src', + redirect: (BuildContext context, GoRouterState state) { + topRedirectLog.add(state.matchedLocation); + if (state.matchedLocation == '/dst') { + return '/final'; + } + return null; + }, + ); + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/final', + ); + expect(find.byType(LoginScreen), findsOneWidget); + // Top-level redirect was evaluated on /dst (after route-level redirect). + expect(topRedirectLog, contains('/dst')); + }); + + testWidgets('top-level redirect returns null after first redirect', ( + WidgetTester tester, + ) async { + // The most common pattern: single redirect, then null on re-evaluation. + var callCount = 0; + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/login', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + callCount++; + if (state.matchedLocation == '/') { + return '/login'; + } + return null; + }, + ); + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/login', + ); + expect(find.byType(LoginScreen), findsOneWidget); + // Redirect is called twice: once for /, once for /login. + expect(callCount, 2); + }); + + testWidgets('top-level redirect chain respects redirect limit', ( + WidgetTester tester, + ) async { + // Endless chain: /0 -> /1 -> /2 -> ... with a low limit. + await createRouter( + [ + for (int i = 0; i <= 20; i++) + GoRoute( + path: '/$i', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + ], + tester, + initialLocation: '/0', + redirect: (BuildContext context, GoRouterState state) { + final RegExpMatch? match = RegExp( + r'^/(\d+)$', + ).firstMatch(state.matchedLocation); + if (match != null) { + final int current = int.parse(match.group(1)!); + return '/${current + 1}'; + } + return null; + }, + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + + expect(find.byType(TestErrorScreen), findsOneWidget); + }); + + testWidgets('top-level redirect chain succeeds at exact redirect limit', ( + WidgetTester tester, + ) async { + // Chain of 2 redirects: / -> /a -> /b. With limit=2, this is exactly + // at the boundary (2 entries added to redirectHistory). + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + return switch (state.matchedLocation) { + '/' => '/a', + '/a' => '/b', + _ => null, + }; + }, + redirectLimit: 2, + ); + + // Exactly 2 redirects with limit=2 should succeed. + expect(router.routerDelegate.currentConfiguration.uri.toString(), '/b'); + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets( + 'top-level redirect chain fails when exceeding redirect limit', + (WidgetTester tester) async { + // Chain of 2 redirects: / -> /a -> /b. With limit=1, the second + // redirect exceeds the limit and should error. + await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + return switch (state.matchedLocation) { + '/' => '/a', + '/a' => '/b', + _ => null, + }; + }, + redirectLimit: 1, + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + + // 2 redirects with limit=1 should error. + expect(find.byType(TestErrorScreen), findsOneWidget); + final TestErrorScreen screen = tester.widget( + find.byType(TestErrorScreen), + ); + expect( + (screen.ex as GoException).message, + startsWith('too many redirects'), + ); + }, + ); + + testWidgets('top-level and route-level redirects share redirect limit', ( + WidgetTester tester, + ) async { + // Top-level: / -> /a (1 redirect) + // Route-level on /a: /a -> /b (1 redirect) + // Route-level on /b: /b -> /c (1 redirect) + // Total: 3 redirects, limit=2 → should error. + await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + redirect: (BuildContext context, GoRouterState state) => '/b', + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + redirect: (BuildContext context, GoRouterState state) => '/c', + ), + GoRoute( + path: '/c', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + if (state.matchedLocation == '/') { + return '/a'; + } + return null; + }, + redirectLimit: 2, + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + + // Combined chain of 3 redirects exceeds the shared limit of 2. + expect(find.byType(TestErrorScreen), findsOneWidget); + final TestErrorScreen screen = tester.widget( + find.byType(TestErrorScreen), + ); + expect( + (screen.ex as GoException).message, + startsWith('too many redirects'), + ); + }); + + testWidgets('async top-level redirect chain loop detection', ( + WidgetTester tester, + ) async { + // Async redirect loop: / -> /a -> /b -> /a (loop) + await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) async { + await Future.delayed(Duration.zero); + return switch (state.matchedLocation) { + '/' => '/a', + '/a' => '/b', + '/b' => '/a', // Loop + _ => null, + }; + }, + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + + await tester.pumpAndSettle(); + + expect(find.byType(TestErrorScreen), findsOneWidget); + final TestErrorScreen screen = tester.widget( + find.byType(TestErrorScreen), + ); + expect( + (screen.ex as GoException).message, + startsWith('redirect loop detected'), + ); + }); + + testWidgets('async top-level redirect into route-level redirect', ( + WidgetTester tester, + ) async { + // Async top-level: / -> /mid (async) + // Route-level on /mid: /mid -> /final (sync) + // Exercises the async boundary between top-level and route-level + // processing, and verifies route-level uses the post-top-level match. + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/mid', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + redirect: (BuildContext context, GoRouterState state) => '/final', + ), + GoRoute( + path: '/final', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) async { + await Future.delayed(Duration.zero); + if (state.matchedLocation == '/') { + return '/mid'; + } + return null; + }, + ); + + await tester.pumpAndSettle(); + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/final', + ); + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets('async route-level redirect into sync top-level chain', ( + WidgetTester tester, + ) async { + // Route-level on /src: /src -> /dst (async) + // Top-level: /dst -> /final (sync) + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + routes: [ + GoRoute( + path: 'src', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + redirect: (BuildContext context, GoRouterState state) async { + await Future.delayed(Duration.zero); + return '/dst'; + }, + ), + ], + ), + GoRoute( + path: '/dst', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/final', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + initialLocation: '/src', + redirect: (BuildContext context, GoRouterState state) { + if (state.matchedLocation == '/dst') { + return '/final'; + } + return null; + }, + ); + + await tester.pumpAndSettle(); + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/final', + ); + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets('sync route-level redirect into async top-level chain', ( + WidgetTester tester, + ) async { + // Route-level on /src: /src -> /dst (sync) + // Top-level: /dst -> /final (async) + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + routes: [ + GoRoute( + path: 'src', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + redirect: (BuildContext context, GoRouterState state) => '/dst', + ), + ], + ), + GoRoute( + path: '/dst', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/final', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + initialLocation: '/src', + redirect: (BuildContext context, GoRouterState state) async { + await Future.delayed(Duration.zero); + if (state.matchedLocation == '/dst') { + return '/final'; + } + return null; + }, + ); + + await tester.pumpAndSettle(); + + expect( + router.routerDelegate.currentConfiguration.uri.toString(), + '/final', + ); + expect(find.byType(LoginScreen), findsOneWidget); + }); + + testWidgets( + 'context disposal during async top-level redirect does not crash', + (WidgetTester tester) async { + // Simulate context disposal while an async top-level redirect is + // in flight. The router should handle this gracefully — not navigate + // to /target after the context is unmounted. + final redirectStarted = Completer(); + final proceedRedirect = Completer(); + + final router = GoRouter( + routes: [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/target', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + redirect: (BuildContext context, GoRouterState state) async { + if (state.matchedLocation == '/') { + redirectStarted.complete(); + await proceedRedirect.future; + return '/target'; + } + return null; + }, + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + addTearDown(router.dispose); + + // Mount the router. + await tester.pumpWidget(MaterialApp.router(routerConfig: router)); + await tester.pump(); + + // Wait for the redirect to start. + await redirectStarted.future; + + // Unmount the MaterialApp.router, which disposes the router context. + await tester.pumpWidget(const SizedBox.shrink()); + + // Let the redirect complete after context is unmounted. + proceedRedirect.complete(); + await tester.pumpAndSettle(); + + // The router should NOT have navigated to /target. + expect(find.byType(LoginScreen), findsNothing); + }, + ); + + testWidgets( + 'context disposal during async route-level redirect does not crash', + (WidgetTester tester) async { + // Same as above but for route-level async redirects. + final redirectStarted = Completer(); + final proceedRedirect = Completer(); + + final router = GoRouter( + routes: [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + redirect: (BuildContext context, GoRouterState state) async { + redirectStarted.complete(); + await proceedRedirect.future; + return '/target'; + }, + ), + GoRoute( + path: '/target', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + errorBuilder: (BuildContext context, GoRouterState state) => + TestErrorScreen(state.error!), + ); + addTearDown(router.dispose); + + await tester.pumpWidget(MaterialApp.router(routerConfig: router)); + await tester.pump(); + + await redirectStarted.future; + + // Unmount the MaterialApp.router. + await tester.pumpWidget(const SizedBox.shrink()); + + // Let the redirect complete after context is unmounted. + proceedRedirect.complete(); + await tester.pumpAndSettle(); + + // The router should NOT have navigated to /target. + expect(find.byType(LoginScreen), findsNothing); + }, + ); + + testWidgets('top-level redirect chain works with router.go()', ( + WidgetTester tester, + ) async { + // Start at /, no redirect from /. Navigate to /a which chains to /c. + final GoRouter router = await createRouter( + [ + GoRoute( + path: '/', + builder: (BuildContext context, GoRouterState state) => + const HomeScreen(), + ), + GoRoute( + path: '/a', + builder: (BuildContext context, GoRouterState state) => + const DummyScreen(), + ), + GoRoute( + path: '/b', + builder: (BuildContext context, GoRouterState state) => + const Page1Screen(), + ), + GoRoute( + path: '/c', + builder: (BuildContext context, GoRouterState state) => + const LoginScreen(), + ), + ], + tester, + redirect: (BuildContext context, GoRouterState state) { + if (state.matchedLocation == '/a') { + return '/b'; + } + if (state.matchedLocation == '/b') { + return '/c'; + } + return null; + }, + ); + + // Initial location is / (no redirect for /). + expect(router.routerDelegate.currentConfiguration.uri.toString(), '/'); + expect(find.byType(HomeScreen), findsOneWidget); + + // Navigate to /a — should chain /a -> /b -> /c. + router.go('/a'); + await tester.pumpAndSettle(); + + expect(router.routerDelegate.currentConfiguration.uri.toString(), '/c'); + expect(find.byType(LoginScreen), findsOneWidget); + }); + }); +} diff --git a/packages/google_fonts/example/linux/flutter/generated_plugins.cmake b/packages/google_fonts/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/google_fonts/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/google_fonts/example/windows/flutter/generated_plugins.cmake b/packages/google_fonts/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/google_fonts/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/app/build.gradle b/packages/google_maps_flutter/google_maps_flutter/example/android/app/build.gradle deleted file mode 100644 index b280828ff39a..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter/example/android/app/build.gradle +++ /dev/null @@ -1,71 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.googlemapsexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - defaultConfig { - manifestPlaceholders = [mapsApiKey: "$System.env.MAPS_API_KEY"] - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") - testImplementation("com.google.android.gms:play-services-maps:17.0.0") - } - namespace = "io.flutter.plugins.googlemapsexample" - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/app/build.gradle.kts b/packages/google_maps_flutter/google_maps_flutter/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..50bc6979a57f --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter/example/android/app/build.gradle.kts @@ -0,0 +1,58 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.googlemapsexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.googlemapsexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + manifestPlaceholders["mapsApiKey"] = System.getenv("MAPS_API_KEY") ?: "" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + + testOptions { + unitTests { + isIncludeAndroidResources = true + } + } + + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") + testImplementation("com.google.android.gms:play-services-maps:17.0.0") +} diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/build.gradle b/packages/google_maps_flutter/google_maps_flutter/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/build.gradle.kts b/packages/google_maps_flutter/google_maps_flutter/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/settings.gradle b/packages/google_maps_flutter/google_maps_flutter/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/google_maps_flutter/google_maps_flutter/example/android/settings.gradle.kts b/packages/google_maps_flutter/google_maps_flutter/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") 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 d19b5b24f8c0..6ce7cb2dd0e4 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.19.6 + +* Fixes the onTap callback for clustered pin info window taps. + ## 2.19.5 * Fixes a crash when using the legacy map renderer by adding the `org.apache.http.legacy` library. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java index 0b28e6a485ec..5921d690a0de 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ClusterManagersController.java @@ -46,6 +46,10 @@ class ClusterManagersController @Nullable private ClusterManager.OnClusterItemClickListener clusterItemClickListener; + @Nullable + private ClusterManager.OnClusterItemInfoWindowClickListener + clusterItemInfoWindowClickListener; + @Nullable private ClusterManagersController.OnClusterItemRendered clusterItemRenderedListener; @@ -71,6 +75,12 @@ void setClusterItemClickListener( initListenersForClusterManagers(); } + void setClusterItemInfoWindowClickListener( + @Nullable ClusterManager.OnClusterItemInfoWindowClickListener listener) { + clusterItemInfoWindowClickListener = listener; + initListenersForClusterManagers(); + } + void setClusterItemRenderedListener( @Nullable ClusterManagersController.OnClusterItemRendered listener) { clusterItemRenderedListener = listener; @@ -79,16 +89,21 @@ void setClusterItemRenderedListener( private void initListenersForClusterManagers() { for (Map.Entry> entry : clusterManagerIdToManager.entrySet()) { - initListenersForClusterManager(entry.getValue(), this, clusterItemClickListener); + initListenersForClusterManager( + entry.getValue(), this, clusterItemClickListener, clusterItemInfoWindowClickListener); } } private void initListenersForClusterManager( ClusterManager clusterManager, @Nullable ClusterManager.OnClusterClickListener clusterClickListener, - @Nullable ClusterManager.OnClusterItemClickListener clusterItemClickListener) { + @Nullable ClusterManager.OnClusterItemClickListener clusterItemClickListener, + @Nullable + ClusterManager.OnClusterItemInfoWindowClickListener + clusterItemInfoWindowClickListener) { clusterManager.setOnClusterClickListener(clusterClickListener); clusterManager.setOnClusterItemClickListener(clusterItemClickListener); + clusterManager.setOnClusterItemInfoWindowClickListener(clusterItemInfoWindowClickListener); } /** Adds new ClusterManagers to the controller. */ @@ -123,7 +138,8 @@ private void initializeRenderer(ClusterManager clusterManager) { break; } clusterManager.setRenderer(clusterRenderer); - initListenersForClusterManager(clusterManager, this, clusterItemClickListener); + initListenersForClusterManager( + clusterManager, this, clusterItemClickListener, clusterItemInfoWindowClickListener); } /** Removes ClusterManagers by given cluster manager IDs from the controller. */ @@ -145,7 +161,7 @@ private void removeClusterManager(Object clusterManagerId) { if (clusterManager == null) { return; } - initListenersForClusterManager(clusterManager, null, null); + initListenersForClusterManager(clusterManager, null, null, null); clusterManager.clearItems(); clusterManager.cluster(); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java index 5a29cd588086..8da755db70ed 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java @@ -62,6 +62,7 @@ class GoogleMapController implements ActivityPluginBinding.OnSaveInstanceStateListener, ClusterManager.OnClusterItemClickListener, + ClusterManager.OnClusterItemInfoWindowClickListener, ClusterManagersController.OnClusterItemRendered, DefaultLifecycleObserver, GoogleMapListener, @@ -223,6 +224,7 @@ public void onMapReady(@NonNull GoogleMap googleMap) { groundOverlaysController.setGoogleMap(googleMap); setMarkerCollectionListener(this); setClusterItemClickListener(this); + setClusterItemInfoWindowClickListener(this); setClusterItemRenderedListener(this); updateInitialClusterManagers(); updateInitialMarkers(); @@ -398,6 +400,7 @@ public void dispose() { setGoogleMapListener(null); setMarkerCollectionListener(null); setClusterItemClickListener(null); + setClusterItemInfoWindowClickListener(null); setClusterItemRenderedListener(null); destroyMapViewIfNecessary(); Lifecycle lifecycle = lifecycleProvider.getLifecycle(); @@ -445,6 +448,17 @@ public void setClusterItemClickListener( clusterManagersController.setClusterItemClickListener(listener); } + @VisibleForTesting + public void setClusterItemInfoWindowClickListener( + @Nullable ClusterManager.OnClusterItemInfoWindowClickListener listener) { + if (googleMap == null) { + Log.v(TAG, "Controller was disposed before GoogleMap was ready."); + return; + } + + clusterManagersController.setClusterItemInfoWindowClickListener(listener); + } + @VisibleForTesting public void setClusterItemRenderedListener( @Nullable ClusterManagersController.OnClusterItemRendered listener) { @@ -827,6 +841,11 @@ public boolean onClusterItemClick(MarkerBuilder item) { return markersController.onMarkerTap(item.markerId()); } + @Override + public void onClusterItemInfoWindowClick(MarkerBuilder item) { + markersController.onClusterItemInfoWindowTap(item.markerId()); + } + public void setMapStyle(@Nullable String style) { if (googleMap == null) { initialMapStyle = style; diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java index 7f95e5d44efe..68550f3daee9 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/MarkersController.java @@ -307,6 +307,14 @@ void onInfoWindowTap(String googleMarkerId) { flutterApi.onInfoWindowTap(markerId, new NoOpVoidResult()); } + /** + * Called when a cluster-managed marker's info window is tapped. Takes the Dart marker ID + * directly. + */ + void onClusterItemInfoWindowTap(String markerId) { + flutterApi.onInfoWindowTap(markerId, new NoOpVoidResult()); + } + /** * Called each time clusterManager adds new visible marker to the map. Creates markerController * for marker for realtime marker updates. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java index 42ca991ef712..d063cb17317a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/GoogleMapControllerTest.java @@ -185,6 +185,21 @@ public void OnMapReadySetsClusterItemClickListener() { verify(spyGoogleMapController, times(1)).setClusterItemClickListener(null); } + @Test + @SuppressWarnings("unchecked") + public void OnMapReadySetsClusterItemInfoWindowClickListener() { + GoogleMapController googleMapController = getGoogleMapController(); + GoogleMapController spyGoogleMapController = spy(googleMapController); + spyGoogleMapController.onMapReady(mockGoogleMap); + + verify(spyGoogleMapController, times(1)) + .setClusterItemInfoWindowClickListener( + any(ClusterManager.OnClusterItemInfoWindowClickListener.class)); + + spyGoogleMapController.dispose(); + verify(spyGoogleMapController, times(1)).setClusterItemInfoWindowClickListener(null); + } + @Test @SuppressWarnings("unchecked") public void OnMapReadySetsClusterItemRenderedListener() { @@ -235,6 +250,15 @@ public void OnClusterItemClickCallsMarkersController() { verify(mockMarkersController, times(1)).onMarkerTap(markerBuilder.markerId()); } + @Test + public void OnClusterItemInfoWindowClickCallsMarkersController() { + GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies(); + MarkerBuilder markerBuilder = new MarkerBuilder("m_1", "cm_1", PlatformMarkerType.MARKER); + + googleMapController.onClusterItemInfoWindowClick(markerBuilder); + verify(mockMarkersController, times(1)).onClusterItemInfoWindowTap(markerBuilder.markerId()); + } + @Test public void SetInitialHeatmaps() { GoogleMapController googleMapController = getGoogleMapControllerWithMockedDependencies(); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/android/app/build.gradle b/packages/google_maps_flutter/google_maps_flutter_android/example/android/app/build.gradle deleted file mode 100644 index b6af084f2397..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/android/app/build.gradle +++ /dev/null @@ -1,72 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.googlemapsexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.googlemapsexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - defaultConfig { - manifestPlaceholders = [mapsApiKey: "$System.env.MAPS_API_KEY"] - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - - testOptions { - unitTests { - includeAndroidResources = true - } - } - - dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") - testImplementation("com.google.android.gms:play-services-maps:17.0.0") - testImplementation("com.google.maps.android:android-maps-utils:4.0.0") - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/android/app/build.gradle.kts b/packages/google_maps_flutter/google_maps_flutter_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..ce958702fc11 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/android/app/build.gradle.kts @@ -0,0 +1,57 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.googlemapsexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.googlemapsexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + manifestPlaceholders["mapsApiKey"] = System.getenv("MAPS_API_KEY") ?: "" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } + + testOptions { + unitTests { + isIncludeAndroidResources = true + } + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") + testImplementation("com.google.android.gms:play-services-maps:17.0.0") + testImplementation("com.google.maps.android:android-maps-utils:4.0.0") +} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/android/build.gradle b/packages/google_maps_flutter/google_maps_flutter_android/example/android/build.gradle deleted file mode 100644 index aba27e72d1ee..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/android/build.gradle +++ /dev/null @@ -1,46 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":google_maps_flutter_android") { - tasks.withType(JavaCompile) { - // Ignore classfile warnings due to https://bugs.openjdk.org/browse/JDK-8190452 - // TODO(stuartmorgan): Remove that ignore once the build uses Java 11+. - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - // Workaround for a warning when building that the above turns into - // an error, coming from jetified-play-services-maps-18.1.0: - // warning: Cannot find annotation method 'value()' in type - // 'GuardedBy': class file for - // javax.annotation.concurrent.GuardedBy not found - dependencies { - implementation("com.google.code.findbugs:jsr305:3.0.2") - } - } - } -} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/android/build.gradle.kts b/packages/google_maps_flutter/google_maps_flutter_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..11f563c766b5 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/android/build.gradle.kts @@ -0,0 +1,49 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":google_maps_flutter_android") { + // Workaround for a warning when building that the above turns into + // an error: + // Cannot find annotation method 'api()' in type 'RequiresApi': class + // file for android.annotation.RequiresApi not found + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror", "-Xlint:-classfile")) + } + } +} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/android/settings.gradle b/packages/google_maps_flutter/google_maps_flutter_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/android/settings.gradle.kts b/packages/google_maps_flutter/google_maps_flutter_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") 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 748e38273331..dea5e50d236c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.19.5 +version: 2.19.6 environment: sdk: ^3.9.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/CHANGELOG.md index 6e4f0cd42613..c6d2011dd6fd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.18.1 + +* Removes the requirement to use static builds with Swift Package Manager. + ## 2.18.0 * Adds support for advanced markers. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/ios/google_maps_flutter_ios_sdk10/Package.swift b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/ios/google_maps_flutter_ios_sdk10/Package.swift index 6bf9b327cbb9..29899ba5c4e5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/ios/google_maps_flutter_ios_sdk10/Package.swift +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/ios/google_maps_flutter_ios_sdk10/Package.swift @@ -13,9 +13,7 @@ let package = Package( .iOS(.v16) ], products: [ - .library( - name: "google-maps-flutter-ios-sdk10", type: .static, - targets: ["google_maps_flutter_ios_sdk10"]) + .library(name: "google-maps-flutter-ios-sdk10", targets: ["google_maps_flutter_ios_sdk10"]) ], dependencies: [ .package(url: "https://github.com/googlemaps/ios-maps-sdk", "10.0.0"..<"11.0.0"), diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/pubspec.yaml index 1c1dc3d98121..23c3148c6331 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk10/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_ios_sdk10 description: iOS implementation of the google_maps_flutter plugin using Google Maps SDK 10. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios_sdk10 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.18.0 +version: 2.18.1 environment: sdk: ^3.10.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/CHANGELOG.md index 6e4f0cd42613..c6d2011dd6fd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.18.1 + +* Removes the requirement to use static builds with Swift Package Manager. + ## 2.18.0 * Adds support for advanced markers. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/ios/google_maps_flutter_ios_sdk9/Package.swift b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/ios/google_maps_flutter_ios_sdk9/Package.swift index cfae007ad590..b77be54888cc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/ios/google_maps_flutter_ios_sdk9/Package.swift +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/ios/google_maps_flutter_ios_sdk9/Package.swift @@ -13,9 +13,7 @@ let package = Package( .iOS(.v15) ], products: [ - .library( - name: "google-maps-flutter-ios-sdk9", type: .static, targets: ["google_maps_flutter_ios_sdk9"] - ) + .library(name: "google-maps-flutter-ios-sdk9", targets: ["google_maps_flutter_ios_sdk9"]) ], dependencies: [ .package(url: "https://github.com/googlemaps/ios-maps-sdk", "9.0.0"..<"10.0.0"), diff --git a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/pubspec.yaml index 6df04f41a402..a9ff72821f0a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios_sdk9/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_ios_sdk9 description: iOS implementation of the google_maps_flutter plugin using Google Maps SDK 9. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios_sdk9 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.18.0 +version: 2.18.1 environment: sdk: ^3.10.0 diff --git a/packages/google_sign_in/google_sign_in/example/android/app/build.gradle b/packages/google_sign_in/google_sign_in/example/android/app/build.gradle deleted file mode 100644 index 30108883acfb..000000000000 --- a/packages/google_sign_in/google_sign_in/example/android/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.googlesigninexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.googlesigninexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - - testOptions { - unitTests.returnDefaultValues = true - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - implementation("com.google.android.gms:play-services-auth:16.0.1") - testImplementation("junit:junit:4.12") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/google_sign_in/google_sign_in/example/android/app/build.gradle.kts b/packages/google_sign_in/google_sign_in/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..a424fcb4fafa --- /dev/null +++ b/packages/google_sign_in/google_sign_in/example/android/app/build.gradle.kts @@ -0,0 +1,56 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.googlesigninexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.googlesigninexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + + testOptions { + unitTests { + isReturnDefaultValues = true + } + } + + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + implementation("com.google.android.gms:play-services-auth:16.0.1") + testImplementation("junit:junit:4.12") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/google_sign_in/google_sign_in/example/android/build.gradle b/packages/google_sign_in/google_sign_in/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/google_sign_in/google_sign_in/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/google_sign_in/google_sign_in/example/android/build.gradle.kts b/packages/google_sign_in/google_sign_in/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/google_sign_in/google_sign_in/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/google_sign_in/google_sign_in/example/android/settings.gradle b/packages/google_sign_in/google_sign_in/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/google_sign_in/google_sign_in/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/google_sign_in/google_sign_in/example/android/settings.gradle.kts b/packages/google_sign_in/google_sign_in/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/google_sign_in/google_sign_in/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle deleted file mode 100644 index 4bc889a0a2fa..000000000000 --- a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle +++ /dev/null @@ -1,66 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" - id 'com.google.gms.google-services' -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.googlesigninexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.googlesigninexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - - testOptions { - unitTests.returnDefaultValues = true - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - implementation("com.google.android.gms:play-services-auth:16.0.1") - testImplementation("junit:junit:4.12") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle.kts b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..fd57346bf3bb --- /dev/null +++ b/packages/google_sign_in/google_sign_in_android/example/android/app/build.gradle.kts @@ -0,0 +1,56 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") + id("com.google.gms.google-services") +} + +android { + namespace = "io.flutter.plugins.googlesigninexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.googlesigninexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + + testOptions { + unitTests { + isReturnDefaultValues = true + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + implementation("com.google.android.gms:play-services-auth:16.0.1") + testImplementation("junit:junit:4.12") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/google_sign_in/google_sign_in_android/example/android/build.gradle b/packages/google_sign_in/google_sign_in_android/example/android/build.gradle deleted file mode 100644 index 92a39343e0d0..000000000000 --- a/packages/google_sign_in/google_sign_in_android/example/android/build.gradle +++ /dev/null @@ -1,41 +0,0 @@ -plugins { - id 'com.google.gms.google-services' version '4.4.2' apply false -} - -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":google_sign_in_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/google_sign_in/google_sign_in_android/example/android/build.gradle.kts b/packages/google_sign_in/google_sign_in_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..da9eae96366a --- /dev/null +++ b/packages/google_sign_in/google_sign_in_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":google_sign_in_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle b/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle.kts b/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..e7acb260f1a5 --- /dev/null +++ b/packages/google_sign_in/google_sign_in_android/example/android/settings.gradle.kts @@ -0,0 +1,29 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" + id("com.google.gms.google-services") version "4.4.2" apply false +} + +include(":app") diff --git a/packages/image_picker/image_picker/example/android/app/build.gradle b/packages/image_picker/image_picker/example/android/app/build.gradle deleted file mode 100755 index 4c6696972f78..000000000000 --- a/packages/image_picker/image_picker/example/android/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.imagepickerexample" - compileSdk = flutter.compileSdkVersion - testOptions.unitTests.includeAndroidResources = true - - - defaultConfig { - applicationId "io.flutter.plugins.imagepicker.example" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } - - testOptions { - unitTests.returnDefaultValues = true - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/image_picker/image_picker/example/android/app/build.gradle.kts b/packages/image_picker/image_picker/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..6f5dfe2c2a5f --- /dev/null +++ b/packages/image_picker/image_picker/example/android/app/build.gradle.kts @@ -0,0 +1,56 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.imagepickerexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.imagepicker.example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + + testOptions { + unitTests { + isIncludeAndroidResources = true + isReturnDefaultValues = true + } + } + + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/image_picker/image_picker/example/android/build.gradle b/packages/image_picker/image_picker/example/android/build.gradle deleted file mode 100755 index b9db5700753a..000000000000 --- a/packages/image_picker/image_picker/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/image_picker/image_picker/example/android/build.gradle.kts b/packages/image_picker/image_picker/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/image_picker/image_picker/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/image_picker/image_picker/example/android/settings.gradle b/packages/image_picker/image_picker/example/android/settings.gradle deleted file mode 100755 index b542cca3f52e..000000000000 --- a/packages/image_picker/image_picker/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/image_picker/image_picker/example/android/settings.gradle.kts b/packages/image_picker/image_picker/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/image_picker/image_picker/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/image_picker/image_picker/example/linux/flutter/generated_plugins.cmake b/packages/image_picker/image_picker/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2db3c22ae228..000000000000 --- a/packages/image_picker/image_picker/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/image_picker/image_picker/example/windows/flutter/generated_plugins.cmake b/packages/image_picker/image_picker/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index a423a02476a2..000000000000 --- a/packages/image_picker/image_picker/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/image_picker/image_picker_android/example/android/app/build.gradle b/packages/image_picker/image_picker_android/example/android/app/build.gradle deleted file mode 100755 index 3f29b26a401a..000000000000 --- a/packages/image_picker/image_picker_android/example/android/app/build.gradle +++ /dev/null @@ -1,67 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.imagepickerexample" - compileSdk = flutter.compileSdkVersion - testOptions.unitTests.includeAndroidResources = true - - - defaultConfig { - applicationId "io.flutter.plugins.imagepicker.example" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } - - testOptions { - unitTests.returnDefaultValues = true - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - implementation(project(':image_picker_android')) - implementation(project(':espresso')) - api("androidx.test:core:1.4.0") -} diff --git a/packages/image_picker/image_picker_android/example/android/app/build.gradle.kts b/packages/image_picker/image_picker_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..1aecc5f621cc --- /dev/null +++ b/packages/image_picker/image_picker_android/example/android/app/build.gradle.kts @@ -0,0 +1,57 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.imagepickerexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.imagepicker.example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } + + testOptions { + unitTests { + isReturnDefaultValues = true + isIncludeAndroidResources = true + } + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + implementation(project(":image_picker_android")) + implementation(project(":espresso")) + api("androidx.test:core:1.4.0") +} diff --git a/packages/image_picker/image_picker_android/example/android/build.gradle b/packages/image_picker/image_picker_android/example/android/build.gradle deleted file mode 100755 index f8a5b5f14eb3..000000000000 --- a/packages/image_picker/image_picker_android/example/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":image_picker_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/image_picker/image_picker_android/example/android/build.gradle.kts b/packages/image_picker/image_picker_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..940967963822 --- /dev/null +++ b/packages/image_picker/image_picker_android/example/android/build.gradle.kts @@ -0,0 +1,49 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":image_picker_android") { + // Workaround for a warning when building that the above turns into + // an error: + // Cannot find annotation method 'api()' in type 'RequiresApi': class + // file for android.annotation.RequiresApi not found + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror", "-Xlint:-classfile")) + } + } +} diff --git a/packages/image_picker/image_picker_android/example/android/settings.gradle b/packages/image_picker/image_picker_android/example/android/settings.gradle deleted file mode 100755 index b542cca3f52e..000000000000 --- a/packages/image_picker/image_picker_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/image_picker/image_picker_android/example/android/settings.gradle.kts b/packages/image_picker/image_picker_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/image_picker/image_picker_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/image_picker/image_picker_linux/example/linux/flutter/generated_plugins.cmake b/packages/image_picker/image_picker_linux/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2db3c22ae228..000000000000 --- a/packages/image_picker/image_picker_linux/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/image_picker/image_picker_windows/example/windows/flutter/generated_plugins.cmake b/packages/image_picker/image_picker_windows/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index a423a02476a2..000000000000 --- a/packages/image_picker/image_picker_windows/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - file_selector_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/in_app_purchase/in_app_purchase/example/android/app/build.gradle b/packages/in_app_purchase/in_app_purchase/example/android/app/build.gradle deleted file mode 100644 index 9039d9da26ba..000000000000 --- a/packages/in_app_purchase/in_app_purchase/example/android/app/build.gradle +++ /dev/null @@ -1,114 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -// Load the build signing secrets from a local `keystore.properties` file. -// TODO(YOU): Create release keys and a `keystore.properties` file. See -// `example/README.md` for more info and `keystore.example.properties` for an -// example. -def keystorePropertiesFile = rootProject.file("keystore.properties") -def keystoreProperties = new Properties() -def configured = true -try { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} catch (IOException e) { - configured = false - logger.error('Release signing information not found.') -} - -project.ext { - // TODO(YOU): Create release keys and a `keystore.properties` file. See - // `example/README.md` for more info and `keystore.example.properties` for an - // example. - APP_ID = configured ? keystoreProperties['appId'] : "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE" - KEYSTORE_STORE_FILE = configured ? rootProject.file(keystoreProperties['storeFile']) : null - KEYSTORE_STORE_PASSWORD = keystoreProperties['storePassword'] - KEYSTORE_KEY_ALIAS = keystoreProperties['keyAlias'] - KEYSTORE_KEY_PASSWORD = keystoreProperties['keyPassword'] - VERSION_CODE = configured ? keystoreProperties['versionCode'].toInteger() : 1 - VERSION_NAME = configured ? keystoreProperties['versionName'] : "0.0.1" -} - -if (project.APP_ID == "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE") { - configured = false - logger.error('Unique package name not set, defaulting to "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE".') -} - -// Log a final error message if we're unable to create a release key signed -// build for an app configured in the Play Developer Console. Apks built in this -// condition won't be able to call any of the BillingClient APIs. -if (!configured) { - logger.error('The app could not be configured for release signing. In app purchases will not be testable. See `example/README.md` for more info and instructions.') -} - -android { - namespace = "io.flutter.plugins.inapppurchaseexample" - signingConfigs { - release { - storeFile project.KEYSTORE_STORE_FILE - storePassword project.KEYSTORE_STORE_PASSWORD - keyAlias project.KEYSTORE_KEY_ALIAS - keyPassword project.KEYSTORE_KEY_PASSWORD - } - } - - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId project.APP_ID - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode project.VERSION_CODE - versionName project.VERSION_NAME - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - // Google Play Billing APIs only work with apps signed for production. - debug { - if (configured) { - signingConfig = signingConfigs.release - } else { - signingConfig = signingConfigs.debug - } - } - release { - if (configured) { - signingConfig = signingConfigs.release - } else { - signingConfig = signingConfigs.debug - } - } - } - - testOptions { - unitTests.returnDefaultValues = true - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - implementation("com.android.billingclient:billing:3.0.2") - testImplementation("junit:junit:4.13.2") - testImplementation("org.mockito:mockito-core:5.0.0") - testImplementation("org.json:json:20251224") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/in_app_purchase/in_app_purchase/example/android/app/build.gradle.kts b/packages/in_app_purchase/in_app_purchase/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..2ba1d93c7bc0 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/android/app/build.gradle.kts @@ -0,0 +1,106 @@ +import java.util.Properties + +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +val keystorePropertiesFile = rootProject.file("keystore.properties") +val keystoreProperties = Properties() +var configured = true +try { + keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) } +} catch (e: java.io.IOException) { + configured = false + logger.error("Release signing information not found.") +} + +val appId = keystoreProperties.getProperty("appId") ?: "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE" +val keystoreStoreFile = if (configured) rootProject.file(keystoreProperties.getProperty("storeFile")) else null +val keystoreStorePassword = keystoreProperties.getProperty("storePassword") +val keystoreKeyAlias = keystoreProperties.getProperty("keyAlias") +val keystoreKeyPassword = keystoreProperties.getProperty("keyPassword") +val versionCodeVal = keystoreProperties.getProperty("versionCode")?.toInt() ?: 1 +val versionNameVal = keystoreProperties.getProperty("versionName") ?: "0.0.1" + +if (appId == "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE") { + configured = false + logger.error("Unique package name not set, defaulting to \"io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE\".") +} + +if (!configured) { + logger.error("The app could not be configured for release signing. In app purchases will not be testable. See `example/README.md` for more info and instructions.") +} + +android { + namespace = "io.flutter.plugins.inapppurchaseexample" + compileSdk = flutter.compileSdkVersion + + signingConfigs { + create("release") { + storeFile = keystoreStoreFile + storePassword = keystoreStorePassword + keyAlias = keystoreKeyAlias + keyPassword = keystoreKeyPassword + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = appId + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = versionCodeVal + versionName = versionNameVal + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + getByName("debug") { + if (configured) { + signingConfig = signingConfigs.getByName("release") + } else { + signingConfig = signingConfigs.getByName("debug") + } + } + getByName("release") { + if (configured) { + signingConfig = signingConfigs.getByName("release") + } else { + signingConfig = signingConfigs.getByName("debug") + } + } + } + + testOptions { + unitTests { + isReturnDefaultValues = true + } + } + + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + implementation("com.android.billingclient:billing:3.0.2") + testImplementation("junit:junit:4.13.2") + testImplementation("org.mockito:mockito-core:5.0.0") + testImplementation("org.json:json:20251224") + androidTestImplementation("androidx.test:runner:1.1.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") +} diff --git a/packages/in_app_purchase/in_app_purchase/example/android/build.gradle b/packages/in_app_purchase/in_app_purchase/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/in_app_purchase/in_app_purchase/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/in_app_purchase/in_app_purchase/example/android/build.gradle.kts b/packages/in_app_purchase/in_app_purchase/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/in_app_purchase/in_app_purchase/example/android/settings.gradle b/packages/in_app_purchase/in_app_purchase/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/in_app_purchase/in_app_purchase/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/in_app_purchase/in_app_purchase/example/android/settings.gradle.kts b/packages/in_app_purchase/in_app_purchase/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/in_app_purchase/in_app_purchase_android/example/android/app/build.gradle b/packages/in_app_purchase/in_app_purchase_android/example/android/app/build.gradle deleted file mode 100644 index 4faccaa79e53..000000000000 --- a/packages/in_app_purchase/in_app_purchase_android/example/android/app/build.gradle +++ /dev/null @@ -1,114 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -// Load the build signing secrets from a local `keystore.properties` file. -// TODO(YOU): Create release keys and a `keystore.properties` file. See -// `example/README.md` for more info and `keystore.example.properties` for an -// example. -def keystorePropertiesFile = rootProject.file("keystore.properties") -def keystoreProperties = new Properties() -def configured = true -try { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} catch (IOException e) { - configured = false - logger.error('Release signing information not found.') -} - -project.ext { - // TODO(YOU): Create release keys and a `keystore.properties` file. See - // `example/README.md` for more info and `keystore.example.properties` for an - // example. - APP_ID = configured ? keystoreProperties['appId'] : "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE" - KEYSTORE_STORE_FILE = configured ? rootProject.file(keystoreProperties['storeFile']) : null - KEYSTORE_STORE_PASSWORD = keystoreProperties['storePassword'] - KEYSTORE_KEY_ALIAS = keystoreProperties['keyAlias'] - KEYSTORE_KEY_PASSWORD = keystoreProperties['keyPassword'] - VERSION_CODE = configured ? keystoreProperties['versionCode'].toInteger() : 1 - VERSION_NAME = configured ? keystoreProperties['versionName'] : "0.0.1" -} - -if (project.APP_ID == "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE") { - configured = false - logger.error('Unique package name not set, defaulting to "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE".') -} - -// Log a final error message if we're unable to create a release key signed -// build for an app configured in the Play Developer Console. Apks built in this -// condition won't be able to call any of the BillingClient APIs. -if (!configured) { - logger.error('The app could not be configured for release signing. In app purchases will not be testable. See `example/README.md` for more info and instructions.') -} - -android { - namespace = "io.flutter.plugins.inapppurchaseexample" - compileSdk = flutter.compileSdkVersion - - signingConfigs { - release { - storeFile project.KEYSTORE_STORE_FILE - storePassword project.KEYSTORE_STORE_PASSWORD - keyAlias project.KEYSTORE_KEY_ALIAS - keyPassword project.KEYSTORE_KEY_PASSWORD - } - } - - - defaultConfig { - applicationId project.APP_ID - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode project.VERSION_CODE - versionName project.VERSION_NAME - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - // Google Play Billing APIs only work with apps signed for production. - debug { - if (configured) { - signingConfig = signingConfigs.release - } else { - signingConfig = signingConfigs.debug - } - } - release { - if (configured) { - signingConfig = signingConfigs.release - } else { - signingConfig = signingConfigs.debug - } - } - } - - testOptions { - unitTests.returnDefaultValues = true - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - implementation("com.android.billingclient:billing:6.1.0") - testImplementation("junit:junit:4.13.2") - testImplementation("org.mockito:mockito-core:5.1.1") - testImplementation("org.json:json:20251224") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/in_app_purchase/in_app_purchase_android/example/android/app/build.gradle.kts b/packages/in_app_purchase/in_app_purchase_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..9f6cc8bf47ef --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_android/example/android/app/build.gradle.kts @@ -0,0 +1,105 @@ +import java.util.Properties + +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +val keystorePropertiesFile = rootProject.file("keystore.properties") +val keystoreProperties = Properties() +var configured = true +try { + keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) } +} catch (e: java.io.IOException) { + configured = false + logger.error("Release signing information not found.") +} + +val appId: String = keystoreProperties.getProperty("appId") ?: "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE" +val keystoreStoreFile: File? = if (configured) rootProject.file(keystoreProperties.getProperty("storeFile")) else null +val keystoreStorePassword = keystoreProperties.getProperty("storePassword") +val keystoreKeyAlias = keystoreProperties.getProperty("keyAlias") +val keystoreKeyPassword = keystoreProperties.getProperty("keyPassword") +val vCode: Int = keystoreProperties.getProperty("versionCode")?.toInt() ?: 1 +val vName: String = keystoreProperties.getProperty("versionName") ?: "0.0.1" + +if (appId == "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE") { + configured = false + logger.error("Unique package name not set, defaulting to \"io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE\".") +} + +if (!configured) { + logger.error("The app could not be configured for release signing. In app purchases will not be testable. See `example/README.md` for more info and instructions.") +} + +android { + namespace = "io.flutter.plugins.inapppurchaseexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + signingConfigs { + create("release") { + storeFile = keystoreStoreFile + storePassword = keystoreStorePassword + keyAlias = keystoreKeyAlias + keyPassword = keystoreKeyPassword + } + } + + defaultConfig { + applicationId = appId + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = vCode + versionName = vName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + debug { + if (configured) { + signingConfig = signingConfigs.getByName("release") + } else { + signingConfig = signingConfigs.getByName("debug") + } + } + release { + if (configured) { + signingConfig = signingConfigs.getByName("release") + } else { + signingConfig = signingConfigs.getByName("debug") + } + } + } + + testOptions { + unitTests { + isReturnDefaultValues = true + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + implementation("com.android.billingclient:billing:6.1.0") + testImplementation("junit:junit:4.13.2") + testImplementation("org.mockito:mockito-core:5.1.1") + testImplementation("org.json:json:20251224") + androidTestImplementation("androidx.test:runner:1.1.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") +} diff --git a/packages/in_app_purchase/in_app_purchase_android/example/android/build.gradle b/packages/in_app_purchase/in_app_purchase_android/example/android/build.gradle deleted file mode 100644 index 38f044d2b4ca..000000000000 --- a/packages/in_app_purchase/in_app_purchase_android/example/android/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":in_app_purchase_android") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/in_app_purchase/in_app_purchase_android/example/android/build.gradle.kts b/packages/in_app_purchase/in_app_purchase_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..96c513f61d31 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":in_app_purchase_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/in_app_purchase/in_app_purchase_android/example/android/settings.gradle b/packages/in_app_purchase/in_app_purchase_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/in_app_purchase/in_app_purchase_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/in_app_purchase/in_app_purchase_android/example/android/settings.gradle.kts b/packages/in_app_purchase/in_app_purchase_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index f3e56c233359..368f7655a3ea 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.0+14 + +* Updates README to use Kotlin gradle rather than Groovy. + ## 0.3.0+13 * Updates build files from Groovy to Kotlin. diff --git a/packages/interactive_media_ads/README.md b/packages/interactive_media_ads/README.md index 4629902c5876..ce0c64743f48 100644 --- a/packages/interactive_media_ads/README.md +++ b/packages/interactive_media_ads/README.md @@ -58,23 +58,22 @@ Add the user permissions required by the IMA SDK for requesting ads in The IMA SDK requires library desugaring enabled, which you must do by setting `coreLibraryDesugaringEnabled true` and adding `coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'` as a dependency in the -`android/app/build.gradle` file. For more details, see +`android/app/build.gradle.kts` file. For more details, see [Java 11+ APIs available through desugaring with the nio specification](https://developer.android.com/studio/write/java11-nio-support-table). - -```groovy + +```kotlin android { // ··· compileOptions { - coreLibraryDesugaringEnabled true - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + isCoreLibraryDesugaringEnabled = true + // ··· } // ··· } // ··· dependencies { - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") // ··· } ``` 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 9ecf4f41c04f..1235e312ccf1 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.3.0+13" + const val pluginVersion = "0.3.0+14" } override fun setAdTagUrl(pigeon_instance: AdsRequest, adTagUrl: String) { diff --git a/packages/interactive_media_ads/example/android/app/build.gradle b/packages/interactive_media_ads/example/android/app/build.gradle.kts similarity index 50% rename from packages/interactive_media_ads/example/android/app/build.gradle rename to packages/interactive_media_ads/example/android/app/build.gradle.kts index bacc8f8e0752..6869e19efec5 100644 --- a/packages/interactive_media_ads/example/android/app/build.gradle +++ b/packages/interactive_media_ads/example/android/app/build.gradle.kts @@ -1,25 +1,7 @@ plugins { - id "com.android.application" - id "kotlin-android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") } // #docregion android_desugaring @@ -31,9 +13,11 @@ android { // #docregion android_desugaring compileOptions { - coreLibraryDesugaringEnabled true + isCoreLibraryDesugaringEnabled = true + // #enddocregion android_desugaring sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 + // #docregion android_desugaring } // #enddocregion android_desugaring @@ -41,22 +25,18 @@ android { jvmTarget = JavaVersion.VERSION_17.toString() } - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - defaultConfig { - applicationId "dev.flutter.packages.interactive_media_ads_example" + applicationId = "dev.flutter.packages.interactive_media_ads_example" minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { - signingConfig = signingConfigs.debug + signingConfig = signingConfigs.getByName("debug") } } // #docregion android_desugaring @@ -64,12 +44,12 @@ android { // #enddocregion android_desugaring flutter { - source = '../..' + source = "../.." } // #docregion android_desugaring dependencies { - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") // #enddocregion android_desugaring testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test:runner:1.2.0") diff --git a/packages/interactive_media_ads/example/android/build.gradle b/packages/interactive_media_ads/example/android/build.gradle deleted file mode 100644 index 4cb8b44195d1..000000000000 --- a/packages/interactive_media_ads/example/android/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -gradle.projectsEvaluated { - project(":interactive_media_ads") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/interactive_media_ads/example/android/build.gradle.kts b/packages/interactive_media_ads/example/android/build.gradle.kts new file mode 100644 index 000000000000..def63e64964a --- /dev/null +++ b/packages/interactive_media_ads/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":interactive_media_ads") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/interactive_media_ads/example/android/settings.gradle b/packages/interactive_media_ads/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/interactive_media_ads/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/interactive_media_ads/example/android/settings.gradle.kts b/packages/interactive_media_ads/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/interactive_media_ads/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") 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 c9c0982339b9..617641a1d5cc 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.3.0+13" + static let pluginVersion = "0.3.0+14" 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 f61c679c68a0..03dddc287613 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.3.0+13 # This must match the version in +version: 0.3.0+14 # 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/local_auth/local_auth/example/android/app/build.gradle b/packages/local_auth/local_auth/example/android/app/build.gradle deleted file mode 100644 index c331558d7a3c..000000000000 --- a/packages/local_auth/local_auth/example/android/app/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.localauthexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.localauthexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/local_auth/local_auth/example/android/app/build.gradle.kts b/packages/local_auth/local_auth/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..520bcf8c629b --- /dev/null +++ b/packages/local_auth/local_auth/example/android/app/build.gradle.kts @@ -0,0 +1,47 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.localauthexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.localauthexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.1.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") +} diff --git a/packages/local_auth/local_auth/example/android/build.gradle b/packages/local_auth/local_auth/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/local_auth/local_auth/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/local_auth/local_auth/example/android/build.gradle.kts b/packages/local_auth/local_auth/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/local_auth/local_auth/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/local_auth/local_auth/example/android/settings.gradle b/packages/local_auth/local_auth/example/android/settings.gradle deleted file mode 100644 index d7ba8d54ffbc..000000000000 --- a/packages/local_auth/local_auth/example/android/settings.gradle +++ /dev/null @@ -1,28 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" - -} - -include ":app" diff --git a/packages/local_auth/local_auth/example/android/settings.gradle.kts b/packages/local_auth/local_auth/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/local_auth/local_auth/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/local_auth/local_auth/example/android/settings_aar.gradle b/packages/local_auth/local_auth/example/android/settings_aar.gradle deleted file mode 100644 index e7b4def49cb5..000000000000 --- a/packages/local_auth/local_auth/example/android/settings_aar.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/packages/local_auth/local_auth/example/windows/flutter/generated_plugins.cmake b/packages/local_auth/local_auth/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index ef187dcae56f..000000000000 --- a/packages/local_auth/local_auth/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - local_auth_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/local_auth/local_auth_android/example/android/app/build.gradle b/packages/local_auth/local_auth_android/example/android/app/build.gradle deleted file mode 100644 index c331558d7a3c..000000000000 --- a/packages/local_auth/local_auth_android/example/android/app/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.localauthexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.localauthexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/local_auth/local_auth_android/example/android/app/build.gradle.kts b/packages/local_auth/local_auth_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..520bcf8c629b --- /dev/null +++ b/packages/local_auth/local_auth_android/example/android/app/build.gradle.kts @@ -0,0 +1,47 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.localauthexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.localauthexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.1.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") +} diff --git a/packages/local_auth/local_auth_android/example/android/build.gradle b/packages/local_auth/local_auth_android/example/android/build.gradle deleted file mode 100644 index 485e7242a07a..000000000000 --- a/packages/local_auth/local_auth_android/example/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":local_auth_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/local_auth/local_auth_android/example/android/build.gradle.kts b/packages/local_auth/local_auth_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..561ebe61aff4 --- /dev/null +++ b/packages/local_auth/local_auth_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":local_auth_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/local_auth/local_auth_android/example/android/settings.gradle b/packages/local_auth/local_auth_android/example/android/settings.gradle deleted file mode 100644 index d7ba8d54ffbc..000000000000 --- a/packages/local_auth/local_auth_android/example/android/settings.gradle +++ /dev/null @@ -1,28 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" - -} - -include ":app" diff --git a/packages/local_auth/local_auth_android/example/android/settings.gradle.kts b/packages/local_auth/local_auth_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/local_auth/local_auth_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/local_auth/local_auth_android/example/android/settings_aar.gradle b/packages/local_auth/local_auth_android/example/android/settings_aar.gradle deleted file mode 100644 index e7b4def49cb5..000000000000 --- a/packages/local_auth/local_auth_android/example/android/settings_aar.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/packages/local_auth/local_auth_windows/example/windows/flutter/generated_plugins.cmake b/packages/local_auth/local_auth_windows/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index ef187dcae56f..000000000000 --- a/packages/local_auth/local_auth_windows/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - local_auth_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/path_provider/path_provider/example/android/app/build.gradle b/packages/path_provider/path_provider/example/android/app/build.gradle deleted file mode 100644 index 991223e59884..000000000000 --- a/packages/path_provider/path_provider/example/android/app/build.gradle +++ /dev/null @@ -1,63 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.pathproviderexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.pathproviderexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test:rules:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/path_provider/path_provider/example/android/app/build.gradle.kts b/packages/path_provider/path_provider/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..5512cac5eec8 --- /dev/null +++ b/packages/path_provider/path_provider/example/android/app/build.gradle.kts @@ -0,0 +1,49 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.pathproviderexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.pathproviderexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test:rules:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + + testImplementation("junit:junit:4.13.2") +} diff --git a/packages/path_provider/path_provider/example/android/build.gradle b/packages/path_provider/path_provider/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/path_provider/path_provider/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/path_provider/path_provider/example/android/build.gradle.kts b/packages/path_provider/path_provider/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/path_provider/path_provider/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/path_provider/path_provider/example/android/settings.gradle b/packages/path_provider/path_provider/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/path_provider/path_provider/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/path_provider/path_provider/example/android/settings.gradle.kts b/packages/path_provider/path_provider/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/path_provider/path_provider/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/path_provider/path_provider/example/linux/flutter/generated_plugins.cmake b/packages/path_provider/path_provider/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/path_provider/path_provider/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/path_provider/path_provider/example/windows/flutter/generated_plugins.cmake b/packages/path_provider/path_provider/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/path_provider/path_provider/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/path_provider/path_provider_android/CHANGELOG.md b/packages/path_provider/path_provider_android/CHANGELOG.md index 106b35fa0676..d68724e90b63 100644 --- a/packages/path_provider/path_provider_android/CHANGELOG.md +++ b/packages/path_provider/path_provider_android/CHANGELOG.md @@ -1,3 +1,12 @@ +## 2.3.1 + +* Removes dependency on `PathUtils` to avoid a potential + `ClassNotFoundException` when running in release mode. + +## 2.3.0 + +* Changes internal implementation to use JNI. + ## 2.2.23 * Updates build files from Groovy to Kotlin. diff --git a/packages/path_provider/path_provider_android/CONTRIBUTING.md b/packages/path_provider/path_provider_android/CONTRIBUTING.md new file mode 100644 index 000000000000..9f764f87c640 --- /dev/null +++ b/packages/path_provider/path_provider_android/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +## `jnigen` + +This package uses [jnigen](https://pub.dev/packages/jnigen) to call Android +methods, rather than using the standard Flutter plugin structure. To add new +functionality to the JNI interface, update `tool/jnigen.dart`, then run: + +```bash +dart run tool/jnigen.dart +``` diff --git a/packages/path_provider/path_provider_android/android/build.gradle.kts b/packages/path_provider/path_provider_android/android/build.gradle.kts deleted file mode 100644 index 3114e6c6385e..000000000000 --- a/packages/path_provider/path_provider_android/android/build.gradle.kts +++ /dev/null @@ -1,64 +0,0 @@ -group = "io.flutter.plugins.pathprovider" -version = "1.0-SNAPSHOT" - -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath("com.android.tools.build:gradle:8.13.1") - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -plugins { - id("com.android.library") -} - -android { - namespace = "io.flutter.plugins.pathprovider" - compileSdk = flutter.compileSdkVersion - - defaultConfig { - minSdk = 24 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - lint { - checkAllWarnings = true - warningsAsErrors = true - disable.addAll(setOf("AndroidGradlePluginVersion", "InvalidPackage", "GradleDependency", "NewerVersionAvailable")) - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - testOptions { - unitTests { - isIncludeAndroidResources = true - isReturnDefaultValues = true - all { - it.outputs.upToDateWhen { false } - it.testLogging { - events("passed", "skipped", "failed", "standardOut", "standardError") - showStandardStreams = true - } - } - } - } -} - -dependencies { - implementation("androidx.annotation:annotation:1.9.1") - testImplementation("junit:junit:4.13.2") -} diff --git a/packages/path_provider/path_provider_android/android/settings.gradle.kts b/packages/path_provider/path_provider_android/android/settings.gradle.kts deleted file mode 100644 index 4fc5bb16d8aa..000000000000 --- a/packages/path_provider/path_provider_android/android/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "path_provider_android" diff --git a/packages/path_provider/path_provider_android/android/src/main/AndroidManifest.xml b/packages/path_provider/path_provider_android/android/src/main/AndroidManifest.xml deleted file mode 100644 index ae9c21c963fd..000000000000 --- a/packages/path_provider/path_provider_android/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/packages/path_provider/path_provider_android/android/src/main/java/io/flutter/plugins/pathprovider/Messages.java b/packages/path_provider/path_provider_android/android/src/main/java/io/flutter/plugins/pathprovider/Messages.java deleted file mode 100644 index 923a8a28e8d2..000000000000 --- a/packages/path_provider/path_provider_android/android/src/main/java/io/flutter/plugins/pathprovider/Messages.java +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. -// See also: https://pub.dev/packages/pigeon - -package io.flutter.plugins.pathprovider; - -import android.util.Log; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MessageCodec; -import io.flutter.plugin.common.StandardMessageCodec; -import java.io.ByteArrayOutputStream; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; - -/** Generated class from Pigeon. */ -@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) -public class Messages { - - /** Error class for passing custom error details to Flutter via a thrown PlatformException. */ - public static class FlutterError extends RuntimeException { - - /** The error code. */ - public final String code; - - /** The error details. Must be a datatype supported by the api codec. */ - public final Object details; - - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { - super(message); - this.code = code; - this.details = details; - } - } - - @NonNull - protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList<>(3); - if (exception instanceof FlutterError) { - FlutterError error = (FlutterError) exception; - errorList.add(error.code); - errorList.add(error.getMessage()); - errorList.add(error.details); - } else { - errorList.add(exception.toString()); - errorList.add(exception.getClass().getSimpleName()); - errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); - } - return errorList; - } - - public enum StorageDirectory { - ROOT(0), - MUSIC(1), - PODCASTS(2), - RINGTONES(3), - ALARMS(4), - NOTIFICATIONS(5), - PICTURES(6), - MOVIES(7), - DOWNLOADS(8), - DCIM(9), - DOCUMENTS(10); - - final int index; - - StorageDirectory(final int index) { - this.index = index; - } - } - - private static class PigeonCodec extends StandardMessageCodec { - public static final PigeonCodec INSTANCE = new PigeonCodec(); - - private PigeonCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : StorageDirectory.values()[((Long) value).intValue()]; - } - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof StorageDirectory) { - stream.write(129); - writeValue(stream, value == null ? null : ((StorageDirectory) value).index); - } else { - super.writeValue(stream, value); - } - } - } - - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ - public interface PathProviderApi { - - @Nullable - String getTemporaryPath(); - - @Nullable - String getApplicationSupportPath(); - - @Nullable - String getApplicationDocumentsPath(); - - @Nullable - String getApplicationCachePath(); - - @Nullable - String getExternalStoragePath(); - - @NonNull - List getExternalCachePaths(); - - @NonNull - List getExternalStoragePaths(@NonNull StorageDirectory directory); - - /** The codec used by PathProviderApi. */ - static @NonNull MessageCodec getCodec() { - return PigeonCodec.INSTANCE; - } - /** - * Sets up an instance of `PathProviderApi` to handle messages through the `binaryMessenger`. - */ - static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProviderApi api) { - setUp(binaryMessenger, "", api); - } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable PathProviderApi api) { - messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; - BinaryMessenger.TaskQueue taskQueue = binaryMessenger.makeBackgroundTaskQueue(); - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.path_provider_android.PathProviderApi.getTemporaryPath" - + messageChannelSuffix, - getCodec(), - taskQueue); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - String output = api.getTemporaryPath(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationSupportPath" - + messageChannelSuffix, - getCodec(), - taskQueue); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - String output = api.getApplicationSupportPath(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationDocumentsPath" - + messageChannelSuffix, - getCodec(), - taskQueue); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - String output = api.getApplicationDocumentsPath(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationCachePath" - + messageChannelSuffix, - getCodec(), - taskQueue); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - String output = api.getApplicationCachePath(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePath" - + messageChannelSuffix, - getCodec(), - taskQueue); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - String output = api.getExternalStoragePath(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalCachePaths" - + messageChannelSuffix, - getCodec(), - taskQueue); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - try { - List output = api.getExternalCachePaths(); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePaths" - + messageChannelSuffix, - getCodec(), - taskQueue); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - StorageDirectory directoryArg = (StorageDirectory) args.get(0); - try { - List output = api.getExternalStoragePaths(directoryArg); - wrapped.add(0, output); - } catch (Throwable exception) { - wrapped = wrapError(exception); - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - } - } -} diff --git a/packages/path_provider/path_provider_android/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java b/packages/path_provider/path_provider_android/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java deleted file mode 100644 index 0484d38832ca..000000000000 --- a/packages/path_provider/path_provider_android/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package io.flutter.plugins.pathprovider; - -import android.content.Context; -import android.util.Log; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; -import io.flutter.embedding.engine.plugins.FlutterPlugin; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugins.pathprovider.Messages.PathProviderApi; -import io.flutter.util.PathUtils; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -public class PathProviderPlugin implements FlutterPlugin, PathProviderApi { - static final String TAG = "PathProviderPlugin"; - private Context context; - - public PathProviderPlugin() {} - - private void setUp(BinaryMessenger messenger, Context context) { - try { - PathProviderApi.setUp(messenger, this); - } catch (Exception ex) { - Log.e(TAG, "Received exception while setting up PathProviderPlugin", ex); - } - - this.context = context; - } - - @Override - public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { - setUp(binding.getBinaryMessenger(), binding.getApplicationContext()); - } - - @Override - public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { - PathProviderApi.setUp(binding.getBinaryMessenger(), null); - } - - @Override - public @Nullable String getTemporaryPath() { - return context.getCacheDir().getPath(); - } - - @Override - public @Nullable String getApplicationSupportPath() { - return PathUtils.getFilesDir(context); - } - - @Override - public @Nullable String getApplicationDocumentsPath() { - return PathUtils.getDataDirectory(context); - } - - @Override - public @Nullable String getApplicationCachePath() { - return context.getCacheDir().getPath(); - } - - @Override - public @Nullable String getExternalStoragePath() { - final File dir = context.getExternalFilesDir(null); - if (dir == null) { - return null; - } - return dir.getAbsolutePath(); - } - - @Override - public @NonNull List getExternalCachePaths() { - final List paths = new ArrayList<>(); - for (File dir : context.getExternalCacheDirs()) { - if (dir != null) { - paths.add(dir.getAbsolutePath()); - } - } - return paths; - } - - @Override - public @NonNull List getExternalStoragePaths( - @NonNull Messages.StorageDirectory directory) { - final List paths = new ArrayList<>(); - for (File dir : context.getExternalFilesDirs(getStorageDirectoryString(directory))) { - if (dir != null) { - paths.add(dir.getAbsolutePath()); - } - } - return paths; - } - - @VisibleForTesting - String getStorageDirectoryString(@NonNull Messages.StorageDirectory directory) { - switch (directory) { - case ROOT: - return null; - case MUSIC: - return "music"; - case PODCASTS: - return "podcasts"; - case RINGTONES: - return "ringtones"; - case ALARMS: - return "alarms"; - case NOTIFICATIONS: - return "notifications"; - case PICTURES: - return "pictures"; - case MOVIES: - return "movies"; - case DOWNLOADS: - return "downloads"; - case DCIM: - return "dcim"; - case DOCUMENTS: - return "documents"; - default: - throw new RuntimeException("Unrecognized directory: " + directory); - } - } -} diff --git a/packages/path_provider/path_provider_android/android/src/test/java/io/flutter/plugins/pathprovider/PathProviderPluginTest.java b/packages/path_provider/path_provider_android/android/src/test/java/io/flutter/plugins/pathprovider/PathProviderPluginTest.java deleted file mode 100644 index ff4bc053c559..000000000000 --- a/packages/path_provider/path_provider_android/android/src/test/java/io/flutter/plugins/pathprovider/PathProviderPluginTest.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package io.flutter.plugins.pathprovider; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -public class PathProviderPluginTest { - @org.junit.Test - public void testStorageDirectoryTypeTranslation() { - final PathProviderPlugin plugin = new PathProviderPlugin(); - assertNull(plugin.getStorageDirectoryString(Messages.StorageDirectory.ROOT)); - assertEquals("music", plugin.getStorageDirectoryString(Messages.StorageDirectory.MUSIC)); - assertEquals("podcasts", plugin.getStorageDirectoryString(Messages.StorageDirectory.PODCASTS)); - assertEquals( - "ringtones", plugin.getStorageDirectoryString(Messages.StorageDirectory.RINGTONES)); - assertEquals("alarms", plugin.getStorageDirectoryString(Messages.StorageDirectory.ALARMS)); - assertEquals( - "notifications", plugin.getStorageDirectoryString(Messages.StorageDirectory.NOTIFICATIONS)); - assertEquals("pictures", plugin.getStorageDirectoryString(Messages.StorageDirectory.PICTURES)); - assertEquals("movies", plugin.getStorageDirectoryString(Messages.StorageDirectory.MOVIES)); - assertEquals( - "downloads", plugin.getStorageDirectoryString(Messages.StorageDirectory.DOWNLOADS)); - assertEquals("dcim", plugin.getStorageDirectoryString(Messages.StorageDirectory.DCIM)); - } -} diff --git a/packages/path_provider/path_provider_android/example/android/app/build.gradle b/packages/path_provider/path_provider_android/example/android/app/build.gradle deleted file mode 100644 index 991223e59884..000000000000 --- a/packages/path_provider/path_provider_android/example/android/app/build.gradle +++ /dev/null @@ -1,63 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.pathproviderexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.pathproviderexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test:rules:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/path_provider/path_provider_android/example/android/app/build.gradle.kts b/packages/path_provider/path_provider_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..713d354ba402 --- /dev/null +++ b/packages/path_provider/path_provider_android/example/android/app/build.gradle.kts @@ -0,0 +1,40 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.pathproviderexample" + compileSdk = flutter.compileSdkVersion + + defaultConfig { + applicationId = "io.flutter.plugins.pathproviderexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test:rules:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + + testImplementation("junit:junit:4.13.2") +} diff --git a/packages/path_provider/path_provider_android/example/android/build.gradle b/packages/path_provider/path_provider_android/example/android/build.gradle deleted file mode 100644 index e073a0d1780a..000000000000 --- a/packages/path_provider/path_provider_android/example/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":path_provider_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/path_provider/path_provider_android/example/android/build.gradle.kts b/packages/path_provider/path_provider_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/path_provider/path_provider_android/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/path_provider/path_provider_android/example/android/settings.gradle b/packages/path_provider/path_provider_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/path_provider/path_provider_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/path_provider/path_provider_android/example/android/settings.gradle.kts b/packages/path_provider/path_provider_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/path_provider/path_provider_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/path_provider/path_provider_android/lib/messages.g.dart b/packages/path_provider/path_provider_android/lib/messages.g.dart deleted file mode 100644 index 29b133c5dab5..000000000000 --- a/packages/path_provider/path_provider_android/lib/messages.g.dart +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. -// See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers - -import 'dart:async'; -import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; - -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; -import 'package:flutter/services.dart'; - -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); -} - -enum StorageDirectory { - root, - music, - podcasts, - ringtones, - alarms, - notifications, - pictures, - movies, - downloads, - dcim, - documents, -} - -class _PigeonCodec extends StandardMessageCodec { - const _PigeonCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is int) { - buffer.putUint8(4); - buffer.putInt64(value); - } else if (value is StorageDirectory) { - buffer.putUint8(129); - writeValue(buffer, value.index); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 129: - final int? value = readValue(buffer) as int?; - return value == null ? null : StorageDirectory.values[value]; - default: - return super.readValueOfType(type, buffer); - } - } -} - -class PathProviderApi { - /// Constructor for [PathProviderApi]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default - /// BinaryMessenger will be used which routes to the host platform. - PathProviderApi({ - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty - ? '.$messageChannelSuffix' - : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; - - static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - - final String pigeonVar_messageChannelSuffix; - - Future getTemporaryPath() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.path_provider_android.PathProviderApi.getTemporaryPath$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } - } - - Future getApplicationSupportPath() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationSupportPath$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } - } - - Future getApplicationDocumentsPath() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationDocumentsPath$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } - } - - Future getApplicationCachePath() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationCachePath$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } - } - - Future getExternalStoragePath() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePath$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } - } - - Future> getExternalCachePaths() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalCachePaths$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as List?)!.cast(); - } - } - - Future> getExternalStoragePaths( - StorageDirectory directory, - ) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePaths$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [directory], - ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as List?)!.cast(); - } - } -} diff --git a/packages/path_provider/path_provider_android/lib/path_provider_android.dart b/packages/path_provider/path_provider_android/lib/path_provider_android.dart index 8931ef4bd7ee..0ad2784305b0 100644 --- a/packages/path_provider/path_provider_android/lib/path_provider_android.dart +++ b/packages/path_provider/path_provider_android/lib/path_provider_android.dart @@ -2,105 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/foundation.dart' show visibleForTesting; -import 'package:path_provider_platform_interface/path_provider_platform_interface.dart'; -import 'messages.g.dart' as messages; - -messages.StorageDirectory _convertStorageDirectory( - StorageDirectory? directory, -) { - switch (directory) { - case null: - return messages.StorageDirectory.root; - case StorageDirectory.music: - return messages.StorageDirectory.music; - case StorageDirectory.podcasts: - return messages.StorageDirectory.podcasts; - case StorageDirectory.ringtones: - return messages.StorageDirectory.ringtones; - case StorageDirectory.alarms: - return messages.StorageDirectory.alarms; - case StorageDirectory.notifications: - return messages.StorageDirectory.notifications; - case StorageDirectory.pictures: - return messages.StorageDirectory.pictures; - case StorageDirectory.movies: - return messages.StorageDirectory.movies; - case StorageDirectory.downloads: - return messages.StorageDirectory.downloads; - case StorageDirectory.dcim: - return messages.StorageDirectory.dcim; - case StorageDirectory.documents: - return messages.StorageDirectory.documents; - } -} - -/// The Android implementation of [PathProviderPlatform]. -class PathProviderAndroid extends PathProviderPlatform { - /// Creates an instance of [PathProviderAndroid]. - PathProviderAndroid({@visibleForTesting messages.PathProviderApi? api}) - : _api = api ?? messages.PathProviderApi(); - - final messages.PathProviderApi _api; - - /// Registers this class as the default instance of [PathProviderPlatform]. - static void registerWith() { - PathProviderPlatform.instance = PathProviderAndroid(); - } - - @override - Future getTemporaryPath() { - return _api.getTemporaryPath(); - } - - @override - Future getApplicationSupportPath() { - return _api.getApplicationSupportPath(); - } - - @override - Future getLibraryPath() { - throw UnsupportedError('getLibraryPath is not supported on Android'); - } - - @override - Future getApplicationDocumentsPath() { - return _api.getApplicationDocumentsPath(); - } - - @override - Future getApplicationCachePath() { - return _api.getApplicationCachePath(); - } - - @override - Future getExternalStoragePath() { - return _api.getExternalStoragePath(); - } - - @override - Future?> getExternalCachePaths() async { - return _api.getExternalCachePaths(); - } - - @override - Future?> getExternalStoragePaths({ - StorageDirectory? type, - }) async { - return _getExternalStoragePaths(type: type); - } - - @override - Future getDownloadsPath() async { - final List paths = await _getExternalStoragePaths( - type: StorageDirectory.downloads, - ); - return paths.isEmpty ? null : paths.first; - } - - Future> _getExternalStoragePaths({ - StorageDirectory? type, - }) async { - return _api.getExternalStoragePaths(_convertStorageDirectory(type)); - } -} +// path_provider_android is implemented using FFI; export a stub for +// platforms that don't support FFI (e.g., web) to avoid having transitive +// dependencies break web compilation. +export 'src/path_provider_android_stub.dart' + if (dart.library.ffi) 'src/path_provider_android_real.dart'; diff --git a/packages/path_provider/path_provider_android/lib/src/path_provider.g.dart b/packages/path_provider/path_provider_android/lib/src/path_provider.g.dart new file mode 100644 index 000000000000..e8b4f3deeeae --- /dev/null +++ b/packages/path_provider/path_provider_android/lib/src/path_provider.g.dart @@ -0,0 +1,9864 @@ +// AUTO GENERATED BY JNIGEN 0.16.0. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: argument_type_not_assignable +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: comment_references +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: inference_failure_on_untyped_parameter +// ignore_for_file: invalid_internal_annotation +// ignore_for_file: invalid_use_of_internal_member +// ignore_for_file: library_prefixes +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_library_prefixes +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: only_throw_errors +// ignore_for_file: overridden_fields +// ignore_for_file: prefer_double_quotes +// ignore_for_file: unintended_html_in_doc_comment +// ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import 'dart:core' as core$_; +import 'dart:core' show Object, String; + +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; + +const _$jniVersionCheck = jni$_.JniVersionCheck(1, 0); + +/// from: `android.content.Context$BindServiceFlags` +extension type Context$BindServiceFlags._(jni$_.JObject _$this) + implements jni$_.JObject { + static final _class = jni$_.JClass.forName( + r'android/content/Context$BindServiceFlags', + ); + + /// The type which includes information such as the signature of this class. + static const jni$_.JType type = + $Context$BindServiceFlags$Type$(); + static final _id_of = _class.staticMethodId( + r'of', + r'(J)Landroid/content/Context$BindServiceFlags;', + ); + + static final _of = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int64,)>, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `static public android.content.Context$BindServiceFlags of(long j)` + /// The returned object must be released after use, by calling the [release] method. + static Context$BindServiceFlags? of(core$_.int j) { + return _of( + _class.reference.pointer, + _id_of.pointer, + j, + ).object(); + } +} + +final class $Context$BindServiceFlags$Type$ + extends jni$_.JType { + @jni$_.internal + const $Context$BindServiceFlags$Type$(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroid/content/Context$BindServiceFlags;'; +} + +/// from: `android.content.Context` +extension type Context._(jni$_.JObject _$this) implements jni$_.JObject { + static final _class = jni$_.JClass.forName(r'android/content/Context'); + + /// The type which includes information such as the signature of this class. + static const jni$_.JType type = $Context$Type$(); + static final _id_ACCESSIBILITY_SERVICE = _class.staticFieldId( + r'ACCESSIBILITY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String ACCESSIBILITY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get ACCESSIBILITY_SERVICE => + _id_ACCESSIBILITY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_ACCOUNT_SERVICE = _class.staticFieldId( + r'ACCOUNT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String ACCOUNT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get ACCOUNT_SERVICE => + _id_ACCOUNT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_ACTIVITY_SERVICE = _class.staticFieldId( + r'ACTIVITY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String ACTIVITY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get ACTIVITY_SERVICE => + _id_ACTIVITY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_ADVANCED_PROTECTION_SERVICE = _class.staticFieldId( + r'ADVANCED_PROTECTION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String ADVANCED_PROTECTION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get ADVANCED_PROTECTION_SERVICE => + _id_ADVANCED_PROTECTION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_ALARM_SERVICE = _class.staticFieldId( + r'ALARM_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String ALARM_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get ALARM_SERVICE => + _id_ALARM_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_APPWIDGET_SERVICE = _class.staticFieldId( + r'APPWIDGET_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String APPWIDGET_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get APPWIDGET_SERVICE => + _id_APPWIDGET_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_APP_FUNCTION_SERVICE = _class.staticFieldId( + r'APP_FUNCTION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String APP_FUNCTION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get APP_FUNCTION_SERVICE => + _id_APP_FUNCTION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_APP_OPS_SERVICE = _class.staticFieldId( + r'APP_OPS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String APP_OPS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get APP_OPS_SERVICE => + _id_APP_OPS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_APP_SEARCH_SERVICE = _class.staticFieldId( + r'APP_SEARCH_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String APP_SEARCH_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get APP_SEARCH_SERVICE => + _id_APP_SEARCH_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_AUDIO_SERVICE = _class.staticFieldId( + r'AUDIO_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String AUDIO_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get AUDIO_SERVICE => + _id_AUDIO_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_BATTERY_SERVICE = _class.staticFieldId( + r'BATTERY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String BATTERY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get BATTERY_SERVICE => + _id_BATTERY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public final int BIND_ABOVE_CLIENT` + static const BIND_ABOVE_CLIENT = 8; + + /// from: `static public final int BIND_ADJUST_WITH_ACTIVITY` + static const BIND_ADJUST_WITH_ACTIVITY = 128; + + /// from: `static public final int BIND_ALLOW_ACTIVITY_STARTS` + static const BIND_ALLOW_ACTIVITY_STARTS = 512; + + /// from: `static public final int BIND_ALLOW_OOM_MANAGEMENT` + static const BIND_ALLOW_OOM_MANAGEMENT = 16; + + /// from: `static public final int BIND_AUTO_CREATE` + static const BIND_AUTO_CREATE = 1; + + /// from: `static public final int BIND_DEBUG_UNBIND` + static const BIND_DEBUG_UNBIND = 2; + + /// from: `static public final int BIND_EXTERNAL_SERVICE` + static const BIND_EXTERNAL_SERVICE = -2147483648; + + /// from: `static public final long BIND_EXTERNAL_SERVICE_LONG` + static const BIND_EXTERNAL_SERVICE_LONG = 4611686018427387904; + + /// from: `static public final int BIND_IMPORTANT` + static const BIND_IMPORTANT = 64; + + /// from: `static public final int BIND_INCLUDE_CAPABILITIES` + static const BIND_INCLUDE_CAPABILITIES = 4096; + + /// from: `static public final int BIND_NOT_FOREGROUND` + static const BIND_NOT_FOREGROUND = 4; + + /// from: `static public final int BIND_NOT_PERCEPTIBLE` + static const BIND_NOT_PERCEPTIBLE = 256; + + /// from: `static public final int BIND_PACKAGE_ISOLATED_PROCESS` + static const BIND_PACKAGE_ISOLATED_PROCESS = 16384; + + /// from: `static public final int BIND_SHARED_ISOLATED_PROCESS` + static const BIND_SHARED_ISOLATED_PROCESS = 8192; + + /// from: `static public final int BIND_WAIVE_PRIORITY` + static const BIND_WAIVE_PRIORITY = 32; + static final _id_BIOMETRIC_SERVICE = _class.staticFieldId( + r'BIOMETRIC_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String BIOMETRIC_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get BIOMETRIC_SERVICE => + _id_BIOMETRIC_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_BLOB_STORE_SERVICE = _class.staticFieldId( + r'BLOB_STORE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String BLOB_STORE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get BLOB_STORE_SERVICE => + _id_BLOB_STORE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_BLUETOOTH_SERVICE = _class.staticFieldId( + r'BLUETOOTH_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String BLUETOOTH_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get BLUETOOTH_SERVICE => + _id_BLUETOOTH_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_BUGREPORT_SERVICE = _class.staticFieldId( + r'BUGREPORT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String BUGREPORT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get BUGREPORT_SERVICE => + _id_BUGREPORT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CAMERA_SERVICE = _class.staticFieldId( + r'CAMERA_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CAMERA_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CAMERA_SERVICE => + _id_CAMERA_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CAPTIONING_SERVICE = _class.staticFieldId( + r'CAPTIONING_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CAPTIONING_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CAPTIONING_SERVICE => + _id_CAPTIONING_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CARRIER_CONFIG_SERVICE = _class.staticFieldId( + r'CARRIER_CONFIG_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CARRIER_CONFIG_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CARRIER_CONFIG_SERVICE => + _id_CARRIER_CONFIG_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CLIPBOARD_SERVICE = _class.staticFieldId( + r'CLIPBOARD_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CLIPBOARD_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CLIPBOARD_SERVICE => + _id_CLIPBOARD_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_COMPANION_DEVICE_SERVICE = _class.staticFieldId( + r'COMPANION_DEVICE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String COMPANION_DEVICE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get COMPANION_DEVICE_SERVICE => + _id_COMPANION_DEVICE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CONNECTIVITY_DIAGNOSTICS_SERVICE = _class.staticFieldId( + r'CONNECTIVITY_DIAGNOSTICS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CONNECTIVITY_DIAGNOSTICS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CONNECTIVITY_DIAGNOSTICS_SERVICE => + _id_CONNECTIVITY_DIAGNOSTICS_SERVICE.getNullable( + _class, + jni$_.JString.type, + ) + as jni$_.JString?; + + static final _id_CONNECTIVITY_SERVICE = _class.staticFieldId( + r'CONNECTIVITY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CONNECTIVITY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CONNECTIVITY_SERVICE => + _id_CONNECTIVITY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CONSUMER_IR_SERVICE = _class.staticFieldId( + r'CONSUMER_IR_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CONSUMER_IR_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CONSUMER_IR_SERVICE => + _id_CONSUMER_IR_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CONTACT_KEYS_SERVICE = _class.staticFieldId( + r'CONTACT_KEYS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CONTACT_KEYS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CONTACT_KEYS_SERVICE => + _id_CONTACT_KEYS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public final int CONTEXT_IGNORE_SECURITY` + static const CONTEXT_IGNORE_SECURITY = 2; + + /// from: `static public final int CONTEXT_INCLUDE_CODE` + static const CONTEXT_INCLUDE_CODE = 1; + + /// from: `static public final int CONTEXT_RESTRICTED` + static const CONTEXT_RESTRICTED = 4; + static final _id_CREDENTIAL_SERVICE = _class.staticFieldId( + r'CREDENTIAL_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CREDENTIAL_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CREDENTIAL_SERVICE => + _id_CREDENTIAL_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_CROSS_PROFILE_APPS_SERVICE = _class.staticFieldId( + r'CROSS_PROFILE_APPS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String CROSS_PROFILE_APPS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get CROSS_PROFILE_APPS_SERVICE => + _id_CROSS_PROFILE_APPS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public final int DEVICE_ID_DEFAULT` + static const DEVICE_ID_DEFAULT = 0; + + /// from: `static public final int DEVICE_ID_INVALID` + static const DEVICE_ID_INVALID = -1; + static final _id_DEVICE_LOCK_SERVICE = _class.staticFieldId( + r'DEVICE_LOCK_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String DEVICE_LOCK_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DEVICE_LOCK_SERVICE => + _id_DEVICE_LOCK_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_DEVICE_POLICY_SERVICE = _class.staticFieldId( + r'DEVICE_POLICY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String DEVICE_POLICY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DEVICE_POLICY_SERVICE => + _id_DEVICE_POLICY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_DISPLAY_HASH_SERVICE = _class.staticFieldId( + r'DISPLAY_HASH_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String DISPLAY_HASH_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DISPLAY_HASH_SERVICE => + _id_DISPLAY_HASH_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_DISPLAY_SERVICE = _class.staticFieldId( + r'DISPLAY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String DISPLAY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DISPLAY_SERVICE => + _id_DISPLAY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_DOMAIN_VERIFICATION_SERVICE = _class.staticFieldId( + r'DOMAIN_VERIFICATION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String DOMAIN_VERIFICATION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DOMAIN_VERIFICATION_SERVICE => + _id_DOMAIN_VERIFICATION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_DOWNLOAD_SERVICE = _class.staticFieldId( + r'DOWNLOAD_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String DOWNLOAD_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DOWNLOAD_SERVICE => + _id_DOWNLOAD_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_DROPBOX_SERVICE = _class.staticFieldId( + r'DROPBOX_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String DROPBOX_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DROPBOX_SERVICE => + _id_DROPBOX_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_EUICC_SERVICE = _class.staticFieldId( + r'EUICC_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String EUICC_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get EUICC_SERVICE => + _id_EUICC_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_FILE_INTEGRITY_SERVICE = _class.staticFieldId( + r'FILE_INTEGRITY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String FILE_INTEGRITY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get FILE_INTEGRITY_SERVICE => + _id_FILE_INTEGRITY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_FINGERPRINT_SERVICE = _class.staticFieldId( + r'FINGERPRINT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String FINGERPRINT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get FINGERPRINT_SERVICE => + _id_FINGERPRINT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_GAME_SERVICE = _class.staticFieldId( + r'GAME_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String GAME_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get GAME_SERVICE => + _id_GAME_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_GRAMMATICAL_INFLECTION_SERVICE = _class.staticFieldId( + r'GRAMMATICAL_INFLECTION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String GRAMMATICAL_INFLECTION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get GRAMMATICAL_INFLECTION_SERVICE => + _id_GRAMMATICAL_INFLECTION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_HARDWARE_PROPERTIES_SERVICE = _class.staticFieldId( + r'HARDWARE_PROPERTIES_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String HARDWARE_PROPERTIES_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get HARDWARE_PROPERTIES_SERVICE => + _id_HARDWARE_PROPERTIES_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_HEALTHCONNECT_SERVICE = _class.staticFieldId( + r'HEALTHCONNECT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String HEALTHCONNECT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get HEALTHCONNECT_SERVICE => + _id_HEALTHCONNECT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_INPUT_METHOD_SERVICE = _class.staticFieldId( + r'INPUT_METHOD_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String INPUT_METHOD_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get INPUT_METHOD_SERVICE => + _id_INPUT_METHOD_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_INPUT_SERVICE = _class.staticFieldId( + r'INPUT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String INPUT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get INPUT_SERVICE => + _id_INPUT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_IPSEC_SERVICE = _class.staticFieldId( + r'IPSEC_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String IPSEC_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get IPSEC_SERVICE => + _id_IPSEC_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_JOB_SCHEDULER_SERVICE = _class.staticFieldId( + r'JOB_SCHEDULER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String JOB_SCHEDULER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get JOB_SCHEDULER_SERVICE => + _id_JOB_SCHEDULER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_KEYGUARD_SERVICE = _class.staticFieldId( + r'KEYGUARD_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String KEYGUARD_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get KEYGUARD_SERVICE => + _id_KEYGUARD_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_KEYSTORE_SERVICE = _class.staticFieldId( + r'KEYSTORE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String KEYSTORE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get KEYSTORE_SERVICE => + _id_KEYSTORE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_LAUNCHER_APPS_SERVICE = _class.staticFieldId( + r'LAUNCHER_APPS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String LAUNCHER_APPS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get LAUNCHER_APPS_SERVICE => + _id_LAUNCHER_APPS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_LAYOUT_INFLATER_SERVICE = _class.staticFieldId( + r'LAYOUT_INFLATER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String LAYOUT_INFLATER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get LAYOUT_INFLATER_SERVICE => + _id_LAYOUT_INFLATER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_LOCALE_SERVICE = _class.staticFieldId( + r'LOCALE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String LOCALE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get LOCALE_SERVICE => + _id_LOCALE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_LOCATION_SERVICE = _class.staticFieldId( + r'LOCATION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String LOCATION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get LOCATION_SERVICE => + _id_LOCATION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_COMMUNICATION_SERVICE = _class.staticFieldId( + r'MEDIA_COMMUNICATION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_COMMUNICATION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_COMMUNICATION_SERVICE => + _id_MEDIA_COMMUNICATION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_METRICS_SERVICE = _class.staticFieldId( + r'MEDIA_METRICS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_METRICS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_METRICS_SERVICE => + _id_MEDIA_METRICS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_PROJECTION_SERVICE = _class.staticFieldId( + r'MEDIA_PROJECTION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_PROJECTION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_PROJECTION_SERVICE => + _id_MEDIA_PROJECTION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_QUALITY_SERVICE = _class.staticFieldId( + r'MEDIA_QUALITY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_QUALITY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_QUALITY_SERVICE => + _id_MEDIA_QUALITY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_ROUTER_SERVICE = _class.staticFieldId( + r'MEDIA_ROUTER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_ROUTER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_ROUTER_SERVICE => + _id_MEDIA_ROUTER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_SESSION_SERVICE = _class.staticFieldId( + r'MEDIA_SESSION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_SESSION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_SESSION_SERVICE => + _id_MEDIA_SESSION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MIDI_SERVICE = _class.staticFieldId( + r'MIDI_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MIDI_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MIDI_SERVICE => + _id_MIDI_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public final int MODE_APPEND` + static const MODE_APPEND = 32768; + + /// from: `static public final int MODE_ENABLE_WRITE_AHEAD_LOGGING` + static const MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; + + /// from: `static public final int MODE_MULTI_PROCESS` + static const MODE_MULTI_PROCESS = 4; + + /// from: `static public final int MODE_NO_LOCALIZED_COLLATORS` + static const MODE_NO_LOCALIZED_COLLATORS = 16; + + /// from: `static public final int MODE_PRIVATE` + static const MODE_PRIVATE = 0; + + /// from: `static public final int MODE_WORLD_READABLE` + static const MODE_WORLD_READABLE = 1; + + /// from: `static public final int MODE_WORLD_WRITEABLE` + static const MODE_WORLD_WRITEABLE = 2; + static final _id_NETWORK_STATS_SERVICE = _class.staticFieldId( + r'NETWORK_STATS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String NETWORK_STATS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get NETWORK_STATS_SERVICE => + _id_NETWORK_STATS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_NFC_SERVICE = _class.staticFieldId( + r'NFC_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String NFC_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get NFC_SERVICE => + _id_NFC_SERVICE.getNullable(_class, jni$_.JString.type) as jni$_.JString?; + + static final _id_NOTIFICATION_SERVICE = _class.staticFieldId( + r'NOTIFICATION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String NOTIFICATION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get NOTIFICATION_SERVICE => + _id_NOTIFICATION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_NSD_SERVICE = _class.staticFieldId( + r'NSD_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String NSD_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get NSD_SERVICE => + _id_NSD_SERVICE.getNullable(_class, jni$_.JString.type) as jni$_.JString?; + + static final _id_OVERLAY_SERVICE = _class.staticFieldId( + r'OVERLAY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String OVERLAY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get OVERLAY_SERVICE => + _id_OVERLAY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_PEOPLE_SERVICE = _class.staticFieldId( + r'PEOPLE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String PEOPLE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get PEOPLE_SERVICE => + _id_PEOPLE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_PERFORMANCE_HINT_SERVICE = _class.staticFieldId( + r'PERFORMANCE_HINT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String PERFORMANCE_HINT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get PERFORMANCE_HINT_SERVICE => + _id_PERFORMANCE_HINT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_PERSISTENT_DATA_BLOCK_SERVICE = _class.staticFieldId( + r'PERSISTENT_DATA_BLOCK_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String PERSISTENT_DATA_BLOCK_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get PERSISTENT_DATA_BLOCK_SERVICE => + _id_PERSISTENT_DATA_BLOCK_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_POWER_SERVICE = _class.staticFieldId( + r'POWER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String POWER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get POWER_SERVICE => + _id_POWER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_PRINT_SERVICE = _class.staticFieldId( + r'PRINT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String PRINT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get PRINT_SERVICE => + _id_PRINT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_PROFILING_SERVICE = _class.staticFieldId( + r'PROFILING_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String PROFILING_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get PROFILING_SERVICE => + _id_PROFILING_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public final int RECEIVER_EXPORTED` + static const RECEIVER_EXPORTED = 2; + + /// from: `static public final int RECEIVER_NOT_EXPORTED` + static const RECEIVER_NOT_EXPORTED = 4; + + /// from: `static public final int RECEIVER_VISIBLE_TO_INSTANT_APPS` + static const RECEIVER_VISIBLE_TO_INSTANT_APPS = 1; + static final _id_RESTRICTIONS_SERVICE = _class.staticFieldId( + r'RESTRICTIONS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String RESTRICTIONS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get RESTRICTIONS_SERVICE => + _id_RESTRICTIONS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_ROLE_SERVICE = _class.staticFieldId( + r'ROLE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String ROLE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get ROLE_SERVICE => + _id_ROLE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_SATELLITE_SERVICE = _class.staticFieldId( + r'SATELLITE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String SATELLITE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get SATELLITE_SERVICE => + _id_SATELLITE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_SEARCH_SERVICE = _class.staticFieldId( + r'SEARCH_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String SEARCH_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get SEARCH_SERVICE => + _id_SEARCH_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_SECURITY_STATE_SERVICE = _class.staticFieldId( + r'SECURITY_STATE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String SECURITY_STATE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get SECURITY_STATE_SERVICE => + _id_SECURITY_STATE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_SENSOR_SERVICE = _class.staticFieldId( + r'SENSOR_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String SENSOR_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get SENSOR_SERVICE => + _id_SENSOR_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_SHORTCUT_SERVICE = _class.staticFieldId( + r'SHORTCUT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String SHORTCUT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get SHORTCUT_SERVICE => + _id_SHORTCUT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_STATUS_BAR_SERVICE = _class.staticFieldId( + r'STATUS_BAR_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String STATUS_BAR_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get STATUS_BAR_SERVICE => + _id_STATUS_BAR_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_STORAGE_SERVICE = _class.staticFieldId( + r'STORAGE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String STORAGE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get STORAGE_SERVICE => + _id_STORAGE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_STORAGE_STATS_SERVICE = _class.staticFieldId( + r'STORAGE_STATS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String STORAGE_STATS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get STORAGE_STATS_SERVICE => + _id_STORAGE_STATS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_SYSTEM_HEALTH_SERVICE = _class.staticFieldId( + r'SYSTEM_HEALTH_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String SYSTEM_HEALTH_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get SYSTEM_HEALTH_SERVICE => + _id_SYSTEM_HEALTH_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TELECOM_SERVICE = _class.staticFieldId( + r'TELECOM_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TELECOM_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TELECOM_SERVICE => + _id_TELECOM_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TELEPHONY_IMS_SERVICE = _class.staticFieldId( + r'TELEPHONY_IMS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TELEPHONY_IMS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TELEPHONY_IMS_SERVICE => + _id_TELEPHONY_IMS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TELEPHONY_SERVICE = _class.staticFieldId( + r'TELEPHONY_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TELEPHONY_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TELEPHONY_SERVICE => + _id_TELEPHONY_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TELEPHONY_SUBSCRIPTION_SERVICE = _class.staticFieldId( + r'TELEPHONY_SUBSCRIPTION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TELEPHONY_SUBSCRIPTION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TELEPHONY_SUBSCRIPTION_SERVICE => + _id_TELEPHONY_SUBSCRIPTION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TETHERING_SERVICE = _class.staticFieldId( + r'TETHERING_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TETHERING_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TETHERING_SERVICE => + _id_TETHERING_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TEXT_CLASSIFICATION_SERVICE = _class.staticFieldId( + r'TEXT_CLASSIFICATION_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TEXT_CLASSIFICATION_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TEXT_CLASSIFICATION_SERVICE => + _id_TEXT_CLASSIFICATION_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TEXT_SERVICES_MANAGER_SERVICE = _class.staticFieldId( + r'TEXT_SERVICES_MANAGER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TEXT_SERVICES_MANAGER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TEXT_SERVICES_MANAGER_SERVICE => + _id_TEXT_SERVICES_MANAGER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TV_AD_SERVICE = _class.staticFieldId( + r'TV_AD_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TV_AD_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TV_AD_SERVICE => + _id_TV_AD_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TV_INPUT_SERVICE = _class.staticFieldId( + r'TV_INPUT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TV_INPUT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TV_INPUT_SERVICE => + _id_TV_INPUT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_TV_INTERACTIVE_APP_SERVICE = _class.staticFieldId( + r'TV_INTERACTIVE_APP_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String TV_INTERACTIVE_APP_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get TV_INTERACTIVE_APP_SERVICE => + _id_TV_INTERACTIVE_APP_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_UI_MODE_SERVICE = _class.staticFieldId( + r'UI_MODE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String UI_MODE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get UI_MODE_SERVICE => + _id_UI_MODE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_USAGE_STATS_SERVICE = _class.staticFieldId( + r'USAGE_STATS_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String USAGE_STATS_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get USAGE_STATS_SERVICE => + _id_USAGE_STATS_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_USB_SERVICE = _class.staticFieldId( + r'USB_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String USB_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get USB_SERVICE => + _id_USB_SERVICE.getNullable(_class, jni$_.JString.type) as jni$_.JString?; + + static final _id_USER_SERVICE = _class.staticFieldId( + r'USER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String USER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get USER_SERVICE => + _id_USER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_VIBRATOR_MANAGER_SERVICE = _class.staticFieldId( + r'VIBRATOR_MANAGER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String VIBRATOR_MANAGER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get VIBRATOR_MANAGER_SERVICE => + _id_VIBRATOR_MANAGER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_VIBRATOR_SERVICE = _class.staticFieldId( + r'VIBRATOR_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String VIBRATOR_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get VIBRATOR_SERVICE => + _id_VIBRATOR_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_VIRTUAL_DEVICE_SERVICE = _class.staticFieldId( + r'VIRTUAL_DEVICE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String VIRTUAL_DEVICE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get VIRTUAL_DEVICE_SERVICE => + _id_VIRTUAL_DEVICE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_VPN_MANAGEMENT_SERVICE = _class.staticFieldId( + r'VPN_MANAGEMENT_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String VPN_MANAGEMENT_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get VPN_MANAGEMENT_SERVICE => + _id_VPN_MANAGEMENT_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_WALLPAPER_SERVICE = _class.staticFieldId( + r'WALLPAPER_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String WALLPAPER_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get WALLPAPER_SERVICE => + _id_WALLPAPER_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_WIFI_AWARE_SERVICE = _class.staticFieldId( + r'WIFI_AWARE_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String WIFI_AWARE_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get WIFI_AWARE_SERVICE => + _id_WIFI_AWARE_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_WIFI_P2P_SERVICE = _class.staticFieldId( + r'WIFI_P2P_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String WIFI_P2P_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get WIFI_P2P_SERVICE => + _id_WIFI_P2P_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_WIFI_RTT_RANGING_SERVICE = _class.staticFieldId( + r'WIFI_RTT_RANGING_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String WIFI_RTT_RANGING_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get WIFI_RTT_RANGING_SERVICE => + _id_WIFI_RTT_RANGING_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_WIFI_SERVICE = _class.staticFieldId( + r'WIFI_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String WIFI_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get WIFI_SERVICE => + _id_WIFI_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_WINDOW_SERVICE = _class.staticFieldId( + r'WINDOW_SERVICE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String WINDOW_SERVICE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get WINDOW_SERVICE => + _id_WINDOW_SERVICE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; +} + +extension Context$$Methods on Context { + static final _id_bindIsolatedService = Context._class.instanceMethodId( + r'bindIsolatedService', + r'(Landroid/content/Intent;Landroid/content/Context$BindServiceFlags;Ljava/lang/String;Ljava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z', + ); + + static final _bindIsolatedService = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean bindIsolatedService(android.content.Intent intent, android.content.Context$BindServiceFlags bindServiceFlags, java.lang.String string, java.util.concurrent.Executor executor, android.content.ServiceConnection serviceConnection)` + core$_.bool bindIsolatedService( + jni$_.JObject? intent, + Context$BindServiceFlags? bindServiceFlags, + jni$_.JString? string, + jni$_.JObject? executor, + jni$_.JObject? serviceConnection, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$bindServiceFlags = + bindServiceFlags?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$executor = executor?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + return _bindIsolatedService( + reference.pointer, + _id_bindIsolatedService.pointer, + _$intent.pointer, + _$bindServiceFlags.pointer, + _$string.pointer, + _$executor.pointer, + _$serviceConnection.pointer, + ).boolean; + } + + static final _id_bindIsolatedService$1 = Context._class.instanceMethodId( + r'bindIsolatedService', + r'(Landroid/content/Intent;ILjava/lang/String;Ljava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z', + ); + + static final _bindIsolatedService$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean bindIsolatedService(android.content.Intent intent, int i, java.lang.String string, java.util.concurrent.Executor executor, android.content.ServiceConnection serviceConnection)` + core$_.bool bindIsolatedService$1( + jni$_.JObject? intent, + core$_.int i, + jni$_.JString? string, + jni$_.JObject? executor, + jni$_.JObject? serviceConnection, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$executor = executor?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + return _bindIsolatedService$1( + reference.pointer, + _id_bindIsolatedService$1.pointer, + _$intent.pointer, + i, + _$string.pointer, + _$executor.pointer, + _$serviceConnection.pointer, + ).boolean; + } + + static final _id_bindService = Context._class.instanceMethodId( + r'bindService', + r'(Landroid/content/Intent;Landroid/content/Context$BindServiceFlags;Ljava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z', + ); + + static final _bindService = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean bindService(android.content.Intent intent, android.content.Context$BindServiceFlags bindServiceFlags, java.util.concurrent.Executor executor, android.content.ServiceConnection serviceConnection)` + core$_.bool bindService( + jni$_.JObject? intent, + Context$BindServiceFlags? bindServiceFlags, + jni$_.JObject? executor, + jni$_.JObject? serviceConnection, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$bindServiceFlags = + bindServiceFlags?.reference ?? jni$_.jNullReference; + final _$executor = executor?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + return _bindService( + reference.pointer, + _id_bindService.pointer, + _$intent.pointer, + _$bindServiceFlags.pointer, + _$executor.pointer, + _$serviceConnection.pointer, + ).boolean; + } + + static final _id_bindService$1 = Context._class.instanceMethodId( + r'bindService', + r'(Landroid/content/Intent;Landroid/content/ServiceConnection;Landroid/content/Context$BindServiceFlags;)Z', + ); + + static final _bindService$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean bindService(android.content.Intent intent, android.content.ServiceConnection serviceConnection, android.content.Context$BindServiceFlags bindServiceFlags)` + core$_.bool bindService$1( + jni$_.JObject? intent, + jni$_.JObject? serviceConnection, + Context$BindServiceFlags? bindServiceFlags, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + final _$bindServiceFlags = + bindServiceFlags?.reference ?? jni$_.jNullReference; + return _bindService$1( + reference.pointer, + _id_bindService$1.pointer, + _$intent.pointer, + _$serviceConnection.pointer, + _$bindServiceFlags.pointer, + ).boolean; + } + + static final _id_bindService$2 = Context._class.instanceMethodId( + r'bindService', + r'(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z', + ); + + static final _bindService$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract boolean bindService(android.content.Intent intent, android.content.ServiceConnection serviceConnection, int i)` + core$_.bool bindService$2( + jni$_.JObject? intent, + jni$_.JObject? serviceConnection, + core$_.int i, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + return _bindService$2( + reference.pointer, + _id_bindService$2.pointer, + _$intent.pointer, + _$serviceConnection.pointer, + i, + ).boolean; + } + + static final _id_bindService$3 = Context._class.instanceMethodId( + r'bindService', + r'(Landroid/content/Intent;ILjava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z', + ); + + static final _bindService$3 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean bindService(android.content.Intent intent, int i, java.util.concurrent.Executor executor, android.content.ServiceConnection serviceConnection)` + core$_.bool bindService$3( + jni$_.JObject? intent, + core$_.int i, + jni$_.JObject? executor, + jni$_.JObject? serviceConnection, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$executor = executor?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + return _bindService$3( + reference.pointer, + _id_bindService$3.pointer, + _$intent.pointer, + i, + _$executor.pointer, + _$serviceConnection.pointer, + ).boolean; + } + + static final _id_bindServiceAsUser = Context._class.instanceMethodId( + r'bindServiceAsUser', + r'(Landroid/content/Intent;Landroid/content/ServiceConnection;Landroid/content/Context$BindServiceFlags;Landroid/os/UserHandle;)Z', + ); + + static final _bindServiceAsUser = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean bindServiceAsUser(android.content.Intent intent, android.content.ServiceConnection serviceConnection, android.content.Context$BindServiceFlags bindServiceFlags, android.os.UserHandle userHandle)` + core$_.bool bindServiceAsUser( + jni$_.JObject? intent, + jni$_.JObject? serviceConnection, + Context$BindServiceFlags? bindServiceFlags, + jni$_.JObject? userHandle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + final _$bindServiceFlags = + bindServiceFlags?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + return _bindServiceAsUser( + reference.pointer, + _id_bindServiceAsUser.pointer, + _$intent.pointer, + _$serviceConnection.pointer, + _$bindServiceFlags.pointer, + _$userHandle.pointer, + ).boolean; + } + + static final _id_bindServiceAsUser$1 = Context._class.instanceMethodId( + r'bindServiceAsUser', + r'(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/UserHandle;)Z', + ); + + static final _bindServiceAsUser$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean bindServiceAsUser(android.content.Intent intent, android.content.ServiceConnection serviceConnection, int i, android.os.UserHandle userHandle)` + core$_.bool bindServiceAsUser$1( + jni$_.JObject? intent, + jni$_.JObject? serviceConnection, + core$_.int i, + jni$_.JObject? userHandle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + return _bindServiceAsUser$1( + reference.pointer, + _id_bindServiceAsUser$1.pointer, + _$intent.pointer, + _$serviceConnection.pointer, + i, + _$userHandle.pointer, + ).boolean; + } + + static final _id_checkCallingOrSelfPermission = Context._class + .instanceMethodId( + r'checkCallingOrSelfPermission', + r'(Ljava/lang/String;)I', + ); + + static final _checkCallingOrSelfPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract int checkCallingOrSelfPermission(java.lang.String string)` + core$_.int checkCallingOrSelfPermission(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _checkCallingOrSelfPermission( + reference.pointer, + _id_checkCallingOrSelfPermission.pointer, + _$string.pointer, + ).integer; + } + + static final _id_checkCallingOrSelfUriPermission = Context._class + .instanceMethodId( + r'checkCallingOrSelfUriPermission', + r'(Landroid/net/Uri;I)I', + ); + + static final _checkCallingOrSelfUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract int checkCallingOrSelfUriPermission(android.net.Uri uri, int i)` + core$_.int checkCallingOrSelfUriPermission(jni$_.JObject? uri, core$_.int i) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + return _checkCallingOrSelfUriPermission( + reference.pointer, + _id_checkCallingOrSelfUriPermission.pointer, + _$uri.pointer, + i, + ).integer; + } + + static final _id_checkCallingOrSelfUriPermissions = Context._class + .instanceMethodId( + r'checkCallingOrSelfUriPermissions', + r'(Ljava/util/List;I)[I', + ); + + static final _checkCallingOrSelfUriPermissions = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public int[] checkCallingOrSelfUriPermissions(java.util.List list, int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JIntArray? checkCallingOrSelfUriPermissions( + jni$_.JList? list, + core$_.int i, + ) { + final _$list = list?.reference ?? jni$_.jNullReference; + return _checkCallingOrSelfUriPermissions( + reference.pointer, + _id_checkCallingOrSelfUriPermissions.pointer, + _$list.pointer, + i, + ).object(); + } + + static final _id_checkCallingPermission = Context._class.instanceMethodId( + r'checkCallingPermission', + r'(Ljava/lang/String;)I', + ); + + static final _checkCallingPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract int checkCallingPermission(java.lang.String string)` + core$_.int checkCallingPermission(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _checkCallingPermission( + reference.pointer, + _id_checkCallingPermission.pointer, + _$string.pointer, + ).integer; + } + + static final _id_checkCallingUriPermission = Context._class.instanceMethodId( + r'checkCallingUriPermission', + r'(Landroid/net/Uri;I)I', + ); + + static final _checkCallingUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract int checkCallingUriPermission(android.net.Uri uri, int i)` + core$_.int checkCallingUriPermission(jni$_.JObject? uri, core$_.int i) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + return _checkCallingUriPermission( + reference.pointer, + _id_checkCallingUriPermission.pointer, + _$uri.pointer, + i, + ).integer; + } + + static final _id_checkCallingUriPermissions = Context._class.instanceMethodId( + r'checkCallingUriPermissions', + r'(Ljava/util/List;I)[I', + ); + + static final _checkCallingUriPermissions = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public int[] checkCallingUriPermissions(java.util.List list, int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JIntArray? checkCallingUriPermissions( + jni$_.JList? list, + core$_.int i, + ) { + final _$list = list?.reference ?? jni$_.jNullReference; + return _checkCallingUriPermissions( + reference.pointer, + _id_checkCallingUriPermissions.pointer, + _$list.pointer, + i, + ).object(); + } + + static final _id_checkContentUriPermissionFull = Context._class + .instanceMethodId( + r'checkContentUriPermissionFull', + r'(Landroid/net/Uri;III)I', + ); + + static final _checkContentUriPermissionFull = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public int checkContentUriPermissionFull(android.net.Uri uri, int i, int i1, int i2)` + core$_.int checkContentUriPermissionFull( + jni$_.JObject? uri, + core$_.int i, + core$_.int i1, + core$_.int i2, + ) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + return _checkContentUriPermissionFull( + reference.pointer, + _id_checkContentUriPermissionFull.pointer, + _$uri.pointer, + i, + i1, + i2, + ).integer; + } + + static final _id_checkPermission = Context._class.instanceMethodId( + r'checkPermission', + r'(Ljava/lang/String;II)I', + ); + + static final _checkPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Int32, jni$_.Int32) + >, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public abstract int checkPermission(java.lang.String string, int i, int i1)` + core$_.int checkPermission( + jni$_.JString? string, + core$_.int i, + core$_.int i1, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _checkPermission( + reference.pointer, + _id_checkPermission.pointer, + _$string.pointer, + i, + i1, + ).integer; + } + + static final _id_checkSelfPermission = Context._class.instanceMethodId( + r'checkSelfPermission', + r'(Ljava/lang/String;)I', + ); + + static final _checkSelfPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract int checkSelfPermission(java.lang.String string)` + core$_.int checkSelfPermission(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _checkSelfPermission( + reference.pointer, + _id_checkSelfPermission.pointer, + _$string.pointer, + ).integer; + } + + static final _id_checkUriPermission = Context._class.instanceMethodId( + r'checkUriPermission', + r'(Landroid/net/Uri;III)I', + ); + + static final _checkUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public abstract int checkUriPermission(android.net.Uri uri, int i, int i1, int i2)` + core$_.int checkUriPermission( + jni$_.JObject? uri, + core$_.int i, + core$_.int i1, + core$_.int i2, + ) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + return _checkUriPermission( + reference.pointer, + _id_checkUriPermission.pointer, + _$uri.pointer, + i, + i1, + i2, + ).integer; + } + + static final _id_checkUriPermission$1 = Context._class.instanceMethodId( + r'checkUriPermission', + r'(Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;III)I', + ); + + static final _checkUriPermission$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public abstract int checkUriPermission(android.net.Uri uri, java.lang.String string, java.lang.String string1, int i, int i1, int i2)` + core$_.int checkUriPermission$1( + jni$_.JObject? uri, + jni$_.JString? string, + jni$_.JString? string1, + core$_.int i, + core$_.int i1, + core$_.int i2, + ) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + return _checkUriPermission$1( + reference.pointer, + _id_checkUriPermission$1.pointer, + _$uri.pointer, + _$string.pointer, + _$string1.pointer, + i, + i1, + i2, + ).integer; + } + + static final _id_checkUriPermissions = Context._class.instanceMethodId( + r'checkUriPermissions', + r'(Ljava/util/List;III)[I', + ); + + static final _checkUriPermissions = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public int[] checkUriPermissions(java.util.List list, int i, int i1, int i2)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JIntArray? checkUriPermissions( + jni$_.JList? list, + core$_.int i, + core$_.int i1, + core$_.int i2, + ) { + final _$list = list?.reference ?? jni$_.jNullReference; + return _checkUriPermissions( + reference.pointer, + _id_checkUriPermissions.pointer, + _$list.pointer, + i, + i1, + i2, + ).object(); + } + + static final _id_clearWallpaper = Context._class.instanceMethodId( + r'clearWallpaper', + r'()V', + ); + + static final _clearWallpaper = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract void clearWallpaper()` + void clearWallpaper() { + _clearWallpaper(reference.pointer, _id_clearWallpaper.pointer).check(); + } + + static final _id_createAttributionContext = Context._class.instanceMethodId( + r'createAttributionContext', + r'(Ljava/lang/String;)Landroid/content/Context;', + ); + + static final _createAttributionContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public android.content.Context createAttributionContext(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Context? createAttributionContext(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _createAttributionContext( + reference.pointer, + _id_createAttributionContext.pointer, + _$string.pointer, + ).object(); + } + + static final _id_createConfigurationContext = Context._class.instanceMethodId( + r'createConfigurationContext', + r'(Landroid/content/res/Configuration;)Landroid/content/Context;', + ); + + static final _createConfigurationContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.content.Context createConfigurationContext(android.content.res.Configuration configuration)` + /// The returned object must be released after use, by calling the [release] method. + Context? createConfigurationContext(jni$_.JObject? configuration) { + final _$configuration = configuration?.reference ?? jni$_.jNullReference; + return _createConfigurationContext( + reference.pointer, + _id_createConfigurationContext.pointer, + _$configuration.pointer, + ).object(); + } + + static final _id_createContext = Context._class.instanceMethodId( + r'createContext', + r'(Landroid/content/ContextParams;)Landroid/content/Context;', + ); + + static final _createContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public android.content.Context createContext(android.content.ContextParams contextParams)` + /// The returned object must be released after use, by calling the [release] method. + Context? createContext(jni$_.JObject? contextParams) { + final _$contextParams = contextParams?.reference ?? jni$_.jNullReference; + return _createContext( + reference.pointer, + _id_createContext.pointer, + _$contextParams.pointer, + ).object(); + } + + static final _id_createContextForSplit = Context._class.instanceMethodId( + r'createContextForSplit', + r'(Ljava/lang/String;)Landroid/content/Context;', + ); + + static final _createContextForSplit = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.content.Context createContextForSplit(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + Context? createContextForSplit(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _createContextForSplit( + reference.pointer, + _id_createContextForSplit.pointer, + _$string.pointer, + ).object(); + } + + static final _id_createDeviceContext = Context._class.instanceMethodId( + r'createDeviceContext', + r'(I)Landroid/content/Context;', + ); + + static final _createDeviceContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public android.content.Context createDeviceContext(int i)` + /// The returned object must be released after use, by calling the [release] method. + Context? createDeviceContext(core$_.int i) { + return _createDeviceContext( + reference.pointer, + _id_createDeviceContext.pointer, + i, + ).object(); + } + + static final _id_createDeviceProtectedStorageContext = Context._class + .instanceMethodId( + r'createDeviceProtectedStorageContext', + r'()Landroid/content/Context;', + ); + + static final _createDeviceProtectedStorageContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.Context createDeviceProtectedStorageContext()` + /// The returned object must be released after use, by calling the [release] method. + Context? createDeviceProtectedStorageContext() { + return _createDeviceProtectedStorageContext( + reference.pointer, + _id_createDeviceProtectedStorageContext.pointer, + ).object(); + } + + static final _id_createDisplayContext = Context._class.instanceMethodId( + r'createDisplayContext', + r'(Landroid/view/Display;)Landroid/content/Context;', + ); + + static final _createDisplayContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.content.Context createDisplayContext(android.view.Display display)` + /// The returned object must be released after use, by calling the [release] method. + Context? createDisplayContext(jni$_.JObject? display) { + final _$display = display?.reference ?? jni$_.jNullReference; + return _createDisplayContext( + reference.pointer, + _id_createDisplayContext.pointer, + _$display.pointer, + ).object(); + } + + static final _id_createPackageContext = Context._class.instanceMethodId( + r'createPackageContext', + r'(Ljava/lang/String;I)Landroid/content/Context;', + ); + + static final _createPackageContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract android.content.Context createPackageContext(java.lang.String string, int i)` + /// The returned object must be released after use, by calling the [release] method. + Context? createPackageContext(jni$_.JString? string, core$_.int i) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _createPackageContext( + reference.pointer, + _id_createPackageContext.pointer, + _$string.pointer, + i, + ).object(); + } + + static final _id_createWindowContext = Context._class.instanceMethodId( + r'createWindowContext', + r'(Landroid/view/Display;ILandroid/os/Bundle;)Landroid/content/Context;', + ); + + static final _createWindowContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public android.content.Context createWindowContext(android.view.Display display, int i, android.os.Bundle bundle)` + /// The returned object must be released after use, by calling the [release] method. + Context? createWindowContext( + jni$_.JObject? display, + core$_.int i, + jni$_.JObject? bundle, + ) { + final _$display = display?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + return _createWindowContext( + reference.pointer, + _id_createWindowContext.pointer, + _$display.pointer, + i, + _$bundle.pointer, + ).object(); + } + + static final _id_createWindowContext$1 = Context._class.instanceMethodId( + r'createWindowContext', + r'(ILandroid/os/Bundle;)Landroid/content/Context;', + ); + + static final _createWindowContext$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Pointer)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public android.content.Context createWindowContext(int i, android.os.Bundle bundle)` + /// The returned object must be released after use, by calling the [release] method. + Context? createWindowContext$1(core$_.int i, jni$_.JObject? bundle) { + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + return _createWindowContext$1( + reference.pointer, + _id_createWindowContext$1.pointer, + i, + _$bundle.pointer, + ).object(); + } + + static final _id_databaseList = Context._class.instanceMethodId( + r'databaseList', + r'()[Ljava/lang/String;', + ); + + static final _databaseList = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.lang.String[] databaseList()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? databaseList() { + return _databaseList( + reference.pointer, + _id_databaseList.pointer, + ).object?>(); + } + + static final _id_deleteDatabase = Context._class.instanceMethodId( + r'deleteDatabase', + r'(Ljava/lang/String;)Z', + ); + + static final _deleteDatabase = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract boolean deleteDatabase(java.lang.String string)` + core$_.bool deleteDatabase(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _deleteDatabase( + reference.pointer, + _id_deleteDatabase.pointer, + _$string.pointer, + ).boolean; + } + + static final _id_deleteFile = Context._class.instanceMethodId( + r'deleteFile', + r'(Ljava/lang/String;)Z', + ); + + static final _deleteFile = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract boolean deleteFile(java.lang.String string)` + core$_.bool deleteFile(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _deleteFile( + reference.pointer, + _id_deleteFile.pointer, + _$string.pointer, + ).boolean; + } + + static final _id_deleteSharedPreferences = Context._class.instanceMethodId( + r'deleteSharedPreferences', + r'(Ljava/lang/String;)Z', + ); + + static final _deleteSharedPreferences = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract boolean deleteSharedPreferences(java.lang.String string)` + core$_.bool deleteSharedPreferences(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _deleteSharedPreferences( + reference.pointer, + _id_deleteSharedPreferences.pointer, + _$string.pointer, + ).boolean; + } + + static final _id_enforceCallingOrSelfPermission = Context._class + .instanceMethodId( + r'enforceCallingOrSelfPermission', + r'(Ljava/lang/String;Ljava/lang/String;)V', + ); + + static final _enforceCallingOrSelfPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void enforceCallingOrSelfPermission(java.lang.String string, java.lang.String string1)` + void enforceCallingOrSelfPermission( + jni$_.JString? string, + jni$_.JString? string1, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + _enforceCallingOrSelfPermission( + reference.pointer, + _id_enforceCallingOrSelfPermission.pointer, + _$string.pointer, + _$string1.pointer, + ).check(); + } + + static final _id_enforceCallingOrSelfUriPermission = Context._class + .instanceMethodId( + r'enforceCallingOrSelfUriPermission', + r'(Landroid/net/Uri;ILjava/lang/String;)V', + ); + + static final _enforceCallingOrSelfUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void enforceCallingOrSelfUriPermission(android.net.Uri uri, int i, java.lang.String string)` + void enforceCallingOrSelfUriPermission( + jni$_.JObject? uri, + core$_.int i, + jni$_.JString? string, + ) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + _enforceCallingOrSelfUriPermission( + reference.pointer, + _id_enforceCallingOrSelfUriPermission.pointer, + _$uri.pointer, + i, + _$string.pointer, + ).check(); + } + + static final _id_enforceCallingPermission = Context._class.instanceMethodId( + r'enforceCallingPermission', + r'(Ljava/lang/String;Ljava/lang/String;)V', + ); + + static final _enforceCallingPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void enforceCallingPermission(java.lang.String string, java.lang.String string1)` + void enforceCallingPermission(jni$_.JString? string, jni$_.JString? string1) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + _enforceCallingPermission( + reference.pointer, + _id_enforceCallingPermission.pointer, + _$string.pointer, + _$string1.pointer, + ).check(); + } + + static final _id_enforceCallingUriPermission = Context._class + .instanceMethodId( + r'enforceCallingUriPermission', + r'(Landroid/net/Uri;ILjava/lang/String;)V', + ); + + static final _enforceCallingUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void enforceCallingUriPermission(android.net.Uri uri, int i, java.lang.String string)` + void enforceCallingUriPermission( + jni$_.JObject? uri, + core$_.int i, + jni$_.JString? string, + ) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + _enforceCallingUriPermission( + reference.pointer, + _id_enforceCallingUriPermission.pointer, + _$uri.pointer, + i, + _$string.pointer, + ).check(); + } + + static final _id_enforcePermission = Context._class.instanceMethodId( + r'enforcePermission', + r'(Ljava/lang/String;IILjava/lang/String;)V', + ); + + static final _enforcePermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void enforcePermission(java.lang.String string, int i, int i1, java.lang.String string1)` + void enforcePermission( + jni$_.JString? string, + core$_.int i, + core$_.int i1, + jni$_.JString? string1, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + _enforcePermission( + reference.pointer, + _id_enforcePermission.pointer, + _$string.pointer, + i, + i1, + _$string1.pointer, + ).check(); + } + + static final _id_enforceUriPermission = Context._class.instanceMethodId( + r'enforceUriPermission', + r'(Landroid/net/Uri;IIILjava/lang/String;)V', + ); + + static final _enforceUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void enforceUriPermission(android.net.Uri uri, int i, int i1, int i2, java.lang.String string)` + void enforceUriPermission( + jni$_.JObject? uri, + core$_.int i, + core$_.int i1, + core$_.int i2, + jni$_.JString? string, + ) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + _enforceUriPermission( + reference.pointer, + _id_enforceUriPermission.pointer, + _$uri.pointer, + i, + i1, + i2, + _$string.pointer, + ).check(); + } + + static final _id_enforceUriPermission$1 = Context._class.instanceMethodId( + r'enforceUriPermission', + r'(Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;IIILjava/lang/String;)V', + ); + + static final _enforceUriPermission$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void enforceUriPermission(android.net.Uri uri, java.lang.String string, java.lang.String string1, int i, int i1, int i2, java.lang.String string2)` + void enforceUriPermission$1( + jni$_.JObject? uri, + jni$_.JString? string, + jni$_.JString? string1, + core$_.int i, + core$_.int i1, + core$_.int i2, + jni$_.JString? string2, + ) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + final _$string2 = string2?.reference ?? jni$_.jNullReference; + _enforceUriPermission$1( + reference.pointer, + _id_enforceUriPermission$1.pointer, + _$uri.pointer, + _$string.pointer, + _$string1.pointer, + i, + i1, + i2, + _$string2.pointer, + ).check(); + } + + static final _id_fileList = Context._class.instanceMethodId( + r'fileList', + r'()[Ljava/lang/String;', + ); + + static final _fileList = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.lang.String[] fileList()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? fileList() { + return _fileList( + reference.pointer, + _id_fileList.pointer, + ).object?>(); + } + + static final _id_get$applicationContext = Context._class.instanceMethodId( + r'getApplicationContext', + r'()Landroid/content/Context;', + ); + + static final _get$applicationContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.Context getApplicationContext()` + /// The returned object must be released after use, by calling the [release] method. + Context? get applicationContext { + return _get$applicationContext( + reference.pointer, + _id_get$applicationContext.pointer, + ).object(); + } + + static final _id_get$applicationInfo = Context._class.instanceMethodId( + r'getApplicationInfo', + r'()Landroid/content/pm/ApplicationInfo;', + ); + + static final _get$applicationInfo = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.pm.ApplicationInfo getApplicationInfo()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get applicationInfo { + return _get$applicationInfo( + reference.pointer, + _id_get$applicationInfo.pointer, + ).object(); + } + + static final _id_get$assets = Context._class.instanceMethodId( + r'getAssets', + r'()Landroid/content/res/AssetManager;', + ); + + static final _get$assets = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.res.AssetManager getAssets()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get assets { + return _get$assets( + reference.pointer, + _id_get$assets.pointer, + ).object(); + } + + static final _id_get$attributionSource = Context._class.instanceMethodId( + r'getAttributionSource', + r'()Landroid/content/AttributionSource;', + ); + + static final _get$attributionSource = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public android.content.AttributionSource getAttributionSource()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get attributionSource { + return _get$attributionSource( + reference.pointer, + _id_get$attributionSource.pointer, + ).object(); + } + + static final _id_get$attributionTag = Context._class.instanceMethodId( + r'getAttributionTag', + r'()Ljava/lang/String;', + ); + + static final _get$attributionTag = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String getAttributionTag()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get attributionTag { + return _get$attributionTag( + reference.pointer, + _id_get$attributionTag.pointer, + ).object(); + } + + static final _id_get$cacheDir = Context._class.instanceMethodId( + r'getCacheDir', + r'()Ljava/io/File;', + ); + + static final _get$cacheDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File getCacheDir()` + /// The returned object must be released after use, by calling the [release] method. + File? get cacheDir { + return _get$cacheDir( + reference.pointer, + _id_get$cacheDir.pointer, + ).object(); + } + + static final _id_get$classLoader = Context._class.instanceMethodId( + r'getClassLoader', + r'()Ljava/lang/ClassLoader;', + ); + + static final _get$classLoader = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.lang.ClassLoader getClassLoader()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get classLoader { + return _get$classLoader( + reference.pointer, + _id_get$classLoader.pointer, + ).object(); + } + + static final _id_get$codeCacheDir = Context._class.instanceMethodId( + r'getCodeCacheDir', + r'()Ljava/io/File;', + ); + + static final _get$codeCacheDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File getCodeCacheDir()` + /// The returned object must be released after use, by calling the [release] method. + File? get codeCacheDir { + return _get$codeCacheDir( + reference.pointer, + _id_get$codeCacheDir.pointer, + ).object(); + } + + static final _id_getColor = Context._class.instanceMethodId( + r'getColor', + r'(I)I', + ); + + static final _getColor = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public final int getColor(int i)` + core$_.int getColor(core$_.int i) { + return _getColor(reference.pointer, _id_getColor.pointer, i).integer; + } + + static final _id_getColorStateList = Context._class.instanceMethodId( + r'getColorStateList', + r'(I)Landroid/content/res/ColorStateList;', + ); + + static final _getColorStateList = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public final android.content.res.ColorStateList getColorStateList(int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getColorStateList(core$_.int i) { + return _getColorStateList( + reference.pointer, + _id_getColorStateList.pointer, + i, + ).object(); + } + + static final _id_get$contentResolver = Context._class.instanceMethodId( + r'getContentResolver', + r'()Landroid/content/ContentResolver;', + ); + + static final _get$contentResolver = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.ContentResolver getContentResolver()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get contentResolver { + return _get$contentResolver( + reference.pointer, + _id_get$contentResolver.pointer, + ).object(); + } + + static final _id_get$dataDir = Context._class.instanceMethodId( + r'getDataDir', + r'()Ljava/io/File;', + ); + + static final _get$dataDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File getDataDir()` + /// The returned object must be released after use, by calling the [release] method. + File? get dataDir { + return _get$dataDir( + reference.pointer, + _id_get$dataDir.pointer, + ).object(); + } + + static final _id_getDatabasePath = Context._class.instanceMethodId( + r'getDatabasePath', + r'(Ljava/lang/String;)Ljava/io/File;', + ); + + static final _getDatabasePath = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract java.io.File getDatabasePath(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + File? getDatabasePath(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getDatabasePath( + reference.pointer, + _id_getDatabasePath.pointer, + _$string.pointer, + ).object(); + } + + static final _id_get$deviceId = Context._class.instanceMethodId( + r'getDeviceId', + r'()I', + ); + + static final _get$deviceId = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public int getDeviceId()` + core$_.int get deviceId { + return _get$deviceId(reference.pointer, _id_get$deviceId.pointer).integer; + } + + static final _id_getDir = Context._class.instanceMethodId( + r'getDir', + r'(Ljava/lang/String;I)Ljava/io/File;', + ); + + static final _getDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract java.io.File getDir(java.lang.String string, int i)` + /// The returned object must be released after use, by calling the [release] method. + File? getDir(jni$_.JString? string, core$_.int i) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getDir( + reference.pointer, + _id_getDir.pointer, + _$string.pointer, + i, + ).object(); + } + + static final _id_get$display = Context._class.instanceMethodId( + r'getDisplay', + r'()Landroid/view/Display;', + ); + + static final _get$display = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public android.view.Display getDisplay()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get display { + return _get$display( + reference.pointer, + _id_get$display.pointer, + ).object(); + } + + static final _id_getDrawable = Context._class.instanceMethodId( + r'getDrawable', + r'(I)Landroid/graphics/drawable/Drawable;', + ); + + static final _getDrawable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public final android.graphics.drawable.Drawable getDrawable(int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getDrawable(core$_.int i) { + return _getDrawable( + reference.pointer, + _id_getDrawable.pointer, + i, + ).object(); + } + + static final _id_get$externalCacheDir = Context._class.instanceMethodId( + r'getExternalCacheDir', + r'()Ljava/io/File;', + ); + + static final _get$externalCacheDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File getExternalCacheDir()` + /// The returned object must be released after use, by calling the [release] method. + File? get externalCacheDir { + return _get$externalCacheDir( + reference.pointer, + _id_get$externalCacheDir.pointer, + ).object(); + } + + static final _id_get$externalCacheDirs = Context._class.instanceMethodId( + r'getExternalCacheDirs', + r'()[Ljava/io/File;', + ); + + static final _get$externalCacheDirs = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File[] getExternalCacheDirs()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? get externalCacheDirs { + return _get$externalCacheDirs( + reference.pointer, + _id_get$externalCacheDirs.pointer, + ).object?>(); + } + + static final _id_getExternalFilesDir = Context._class.instanceMethodId( + r'getExternalFilesDir', + r'(Ljava/lang/String;)Ljava/io/File;', + ); + + static final _getExternalFilesDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract java.io.File getExternalFilesDir(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + File? getExternalFilesDir(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getExternalFilesDir( + reference.pointer, + _id_getExternalFilesDir.pointer, + _$string.pointer, + ).object(); + } + + static final _id_getExternalFilesDirs = Context._class.instanceMethodId( + r'getExternalFilesDirs', + r'(Ljava/lang/String;)[Ljava/io/File;', + ); + + static final _getExternalFilesDirs = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract java.io.File[] getExternalFilesDirs(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? getExternalFilesDirs(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getExternalFilesDirs( + reference.pointer, + _id_getExternalFilesDirs.pointer, + _$string.pointer, + ).object?>(); + } + + static final _id_get$externalMediaDirs = Context._class.instanceMethodId( + r'getExternalMediaDirs', + r'()[Ljava/io/File;', + ); + + static final _get$externalMediaDirs = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File[] getExternalMediaDirs()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? get externalMediaDirs { + return _get$externalMediaDirs( + reference.pointer, + _id_get$externalMediaDirs.pointer, + ).object?>(); + } + + static final _id_getFileStreamPath = Context._class.instanceMethodId( + r'getFileStreamPath', + r'(Ljava/lang/String;)Ljava/io/File;', + ); + + static final _getFileStreamPath = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract java.io.File getFileStreamPath(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + File? getFileStreamPath(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getFileStreamPath( + reference.pointer, + _id_getFileStreamPath.pointer, + _$string.pointer, + ).object(); + } + + static final _id_get$filesDir = Context._class.instanceMethodId( + r'getFilesDir', + r'()Ljava/io/File;', + ); + + static final _get$filesDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File getFilesDir()` + /// The returned object must be released after use, by calling the [release] method. + File? get filesDir { + return _get$filesDir( + reference.pointer, + _id_get$filesDir.pointer, + ).object(); + } + + static final _id_get$mainExecutor = Context._class.instanceMethodId( + r'getMainExecutor', + r'()Ljava/util/concurrent/Executor;', + ); + + static final _get$mainExecutor = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.util.concurrent.Executor getMainExecutor()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get mainExecutor { + return _get$mainExecutor( + reference.pointer, + _id_get$mainExecutor.pointer, + ).object(); + } + + static final _id_get$mainLooper = Context._class.instanceMethodId( + r'getMainLooper', + r'()Landroid/os/Looper;', + ); + + static final _get$mainLooper = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.os.Looper getMainLooper()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get mainLooper { + return _get$mainLooper( + reference.pointer, + _id_get$mainLooper.pointer, + ).object(); + } + + static final _id_get$noBackupFilesDir = Context._class.instanceMethodId( + r'getNoBackupFilesDir', + r'()Ljava/io/File;', + ); + + static final _get$noBackupFilesDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File getNoBackupFilesDir()` + /// The returned object must be released after use, by calling the [release] method. + File? get noBackupFilesDir { + return _get$noBackupFilesDir( + reference.pointer, + _id_get$noBackupFilesDir.pointer, + ).object(); + } + + static final _id_get$obbDir = Context._class.instanceMethodId( + r'getObbDir', + r'()Ljava/io/File;', + ); + + static final _get$obbDir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File getObbDir()` + /// The returned object must be released after use, by calling the [release] method. + File? get obbDir { + return _get$obbDir( + reference.pointer, + _id_get$obbDir.pointer, + ).object(); + } + + static final _id_get$obbDirs = Context._class.instanceMethodId( + r'getObbDirs', + r'()[Ljava/io/File;', + ); + + static final _get$obbDirs = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.io.File[] getObbDirs()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? get obbDirs { + return _get$obbDirs( + reference.pointer, + _id_get$obbDirs.pointer, + ).object?>(); + } + + static final _id_get$opPackageName = Context._class.instanceMethodId( + r'getOpPackageName', + r'()Ljava/lang/String;', + ); + + static final _get$opPackageName = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String getOpPackageName()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get opPackageName { + return _get$opPackageName( + reference.pointer, + _id_get$opPackageName.pointer, + ).object(); + } + + static final _id_get$packageCodePath = Context._class.instanceMethodId( + r'getPackageCodePath', + r'()Ljava/lang/String;', + ); + + static final _get$packageCodePath = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.lang.String getPackageCodePath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get packageCodePath { + return _get$packageCodePath( + reference.pointer, + _id_get$packageCodePath.pointer, + ).object(); + } + + static final _id_get$packageManager = Context._class.instanceMethodId( + r'getPackageManager', + r'()Landroid/content/pm/PackageManager;', + ); + + static final _get$packageManager = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.pm.PackageManager getPackageManager()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get packageManager { + return _get$packageManager( + reference.pointer, + _id_get$packageManager.pointer, + ).object(); + } + + static final _id_get$packageName = Context._class.instanceMethodId( + r'getPackageName', + r'()Ljava/lang/String;', + ); + + static final _get$packageName = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.lang.String getPackageName()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get packageName { + return _get$packageName( + reference.pointer, + _id_get$packageName.pointer, + ).object(); + } + + static final _id_get$packageResourcePath = Context._class.instanceMethodId( + r'getPackageResourcePath', + r'()Ljava/lang/String;', + ); + + static final _get$packageResourcePath = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract java.lang.String getPackageResourcePath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get packageResourcePath { + return _get$packageResourcePath( + reference.pointer, + _id_get$packageResourcePath.pointer, + ).object(); + } + + static final _id_get$params = Context._class.instanceMethodId( + r'getParams', + r'()Landroid/content/ContextParams;', + ); + + static final _get$params = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public android.content.ContextParams getParams()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get params { + return _get$params( + reference.pointer, + _id_get$params.pointer, + ).object(); + } + + static final _id_get$resources = Context._class.instanceMethodId( + r'getResources', + r'()Landroid/content/res/Resources;', + ); + + static final _get$resources = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.res.Resources getResources()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get resources { + return _get$resources( + reference.pointer, + _id_get$resources.pointer, + ).object(); + } + + static final _id_getSharedPreferences = Context._class.instanceMethodId( + r'getSharedPreferences', + r'(Ljava/lang/String;I)Landroid/content/SharedPreferences;', + ); + + static final _getSharedPreferences = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract android.content.SharedPreferences getSharedPreferences(java.lang.String string, int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getSharedPreferences(jni$_.JString? string, core$_.int i) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getSharedPreferences( + reference.pointer, + _id_getSharedPreferences.pointer, + _$string.pointer, + i, + ).object(); + } + + static final _id_getString = Context._class.instanceMethodId( + r'getString', + r'(I)Ljava/lang/String;', + ); + + static final _getString = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public final java.lang.String getString(int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getString(core$_.int i) { + return _getString( + reference.pointer, + _id_getString.pointer, + i, + ).object(); + } + + static final _id_getString$1 = Context._class.instanceMethodId( + r'getString', + r'(I[Ljava/lang/Object;)Ljava/lang/String;', + ); + + static final _getString$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Pointer)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public final java.lang.String getString(int i, java.lang.Object[] objects)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getString$1( + core$_.int i, + jni$_.JArray? objects, + ) { + final _$objects = objects?.reference ?? jni$_.jNullReference; + return _getString$1( + reference.pointer, + _id_getString$1.pointer, + i, + _$objects.pointer, + ).object(); + } + + static final _id_getSystemService = Context._class.instanceMethodId( + r'getSystemService', + r'(Ljava/lang/Class;)Ljava/lang/Object;', + ); + + static final _getSystemService = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public final T getSystemService(java.lang.Class class)` + /// The returned object must be released after use, by calling the [release] method. + $T? getSystemService<$T extends jni$_.JObject?>(jni$_.JObject? class$) { + final _$class$ = class$?.reference ?? jni$_.jNullReference; + return _getSystemService( + reference.pointer, + _id_getSystemService.pointer, + _$class$.pointer, + ).object<$T?>(); + } + + static final _id_getSystemService$1 = Context._class.instanceMethodId( + r'getSystemService', + r'(Ljava/lang/String;)Ljava/lang/Object;', + ); + + static final _getSystemService$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract java.lang.Object getSystemService(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getSystemService$1(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getSystemService$1( + reference.pointer, + _id_getSystemService$1.pointer, + _$string.pointer, + ).object(); + } + + static final _id_getSystemServiceName = Context._class.instanceMethodId( + r'getSystemServiceName', + r'(Ljava/lang/Class;)Ljava/lang/String;', + ); + + static final _getSystemServiceName = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract java.lang.String getSystemServiceName(java.lang.Class class)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getSystemServiceName(jni$_.JObject? class$) { + final _$class$ = class$?.reference ?? jni$_.jNullReference; + return _getSystemServiceName( + reference.pointer, + _id_getSystemServiceName.pointer, + _$class$.pointer, + ).object(); + } + + static final _id_getText = Context._class.instanceMethodId( + r'getText', + r'(I)Ljava/lang/CharSequence;', + ); + + static final _getText = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public final java.lang.CharSequence getText(int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getText(core$_.int i) { + return _getText( + reference.pointer, + _id_getText.pointer, + i, + ).object(); + } + + static final _id_get$theme = Context._class.instanceMethodId( + r'getTheme', + r'()Landroid/content/res/Resources$Theme;', + ); + + static final _get$theme = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.content.res.Resources$Theme getTheme()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get theme { + return _get$theme( + reference.pointer, + _id_get$theme.pointer, + ).object(); + } + + static final _id_get$wallpaper = Context._class.instanceMethodId( + r'getWallpaper', + r'()Landroid/graphics/drawable/Drawable;', + ); + + static final _get$wallpaper = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.graphics.drawable.Drawable getWallpaper()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? get wallpaper { + return _get$wallpaper( + reference.pointer, + _id_get$wallpaper.pointer, + ).object(); + } + + static final _id_get$wallpaperDesiredMinimumHeight = Context._class + .instanceMethodId(r'getWallpaperDesiredMinimumHeight', r'()I'); + + static final _get$wallpaperDesiredMinimumHeight = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract int getWallpaperDesiredMinimumHeight()` + core$_.int get wallpaperDesiredMinimumHeight { + return _get$wallpaperDesiredMinimumHeight( + reference.pointer, + _id_get$wallpaperDesiredMinimumHeight.pointer, + ).integer; + } + + static final _id_get$wallpaperDesiredMinimumWidth = Context._class + .instanceMethodId(r'getWallpaperDesiredMinimumWidth', r'()I'); + + static final _get$wallpaperDesiredMinimumWidth = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract int getWallpaperDesiredMinimumWidth()` + core$_.int get wallpaperDesiredMinimumWidth { + return _get$wallpaperDesiredMinimumWidth( + reference.pointer, + _id_get$wallpaperDesiredMinimumWidth.pointer, + ).integer; + } + + static final _id_grantUriPermission = Context._class.instanceMethodId( + r'grantUriPermission', + r'(Ljava/lang/String;Landroid/net/Uri;I)V', + ); + + static final _grantUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract void grantUriPermission(java.lang.String string, android.net.Uri uri, int i)` + void grantUriPermission( + jni$_.JString? string, + jni$_.JObject? uri, + core$_.int i, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$uri = uri?.reference ?? jni$_.jNullReference; + _grantUriPermission( + reference.pointer, + _id_grantUriPermission.pointer, + _$string.pointer, + _$uri.pointer, + i, + ).check(); + } + + static final _id_get$isDeviceProtectedStorage = Context._class + .instanceMethodId(r'isDeviceProtectedStorage', r'()Z'); + + static final _get$isDeviceProtectedStorage = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract boolean isDeviceProtectedStorage()` + core$_.bool get isDeviceProtectedStorage { + return _get$isDeviceProtectedStorage( + reference.pointer, + _id_get$isDeviceProtectedStorage.pointer, + ).boolean; + } + + static final _id_get$isRestricted = Context._class.instanceMethodId( + r'isRestricted', + r'()Z', + ); + + static final _get$isRestricted = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean isRestricted()` + core$_.bool get isRestricted { + return _get$isRestricted( + reference.pointer, + _id_get$isRestricted.pointer, + ).boolean; + } + + static final _id_get$isUiContext = Context._class.instanceMethodId( + r'isUiContext', + r'()Z', + ); + + static final _get$isUiContext = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean isUiContext()` + core$_.bool get isUiContext { + return _get$isUiContext( + reference.pointer, + _id_get$isUiContext.pointer, + ).boolean; + } + + static final _id_moveDatabaseFrom = Context._class.instanceMethodId( + r'moveDatabaseFrom', + r'(Landroid/content/Context;Ljava/lang/String;)Z', + ); + + static final _moveDatabaseFrom = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract boolean moveDatabaseFrom(android.content.Context context, java.lang.String string)` + core$_.bool moveDatabaseFrom(Context? context, jni$_.JString? string) { + final _$context = context?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + return _moveDatabaseFrom( + reference.pointer, + _id_moveDatabaseFrom.pointer, + _$context.pointer, + _$string.pointer, + ).boolean; + } + + static final _id_moveSharedPreferencesFrom = Context._class.instanceMethodId( + r'moveSharedPreferencesFrom', + r'(Landroid/content/Context;Ljava/lang/String;)Z', + ); + + static final _moveSharedPreferencesFrom = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract boolean moveSharedPreferencesFrom(android.content.Context context, java.lang.String string)` + core$_.bool moveSharedPreferencesFrom( + Context? context, + jni$_.JString? string, + ) { + final _$context = context?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + return _moveSharedPreferencesFrom( + reference.pointer, + _id_moveSharedPreferencesFrom.pointer, + _$context.pointer, + _$string.pointer, + ).boolean; + } + + static final _id_obtainStyledAttributes = Context._class.instanceMethodId( + r'obtainStyledAttributes', + r'(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;', + ); + + static final _obtainStyledAttributes = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public final android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet attributeSet, int[] is)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? obtainStyledAttributes( + jni$_.JObject? attributeSet, + jni$_.JIntArray? is$, + ) { + final _$attributeSet = attributeSet?.reference ?? jni$_.jNullReference; + final _$is$ = is$?.reference ?? jni$_.jNullReference; + return _obtainStyledAttributes( + reference.pointer, + _id_obtainStyledAttributes.pointer, + _$attributeSet.pointer, + _$is$.pointer, + ).object(); + } + + static final _id_obtainStyledAttributes$1 = Context._class.instanceMethodId( + r'obtainStyledAttributes', + r'(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;', + ); + + static final _obtainStyledAttributes$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public final android.content.res.TypedArray obtainStyledAttributes(android.util.AttributeSet attributeSet, int[] is, int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? obtainStyledAttributes$1( + jni$_.JObject? attributeSet, + jni$_.JIntArray? is$, + core$_.int i, + core$_.int i1, + ) { + final _$attributeSet = attributeSet?.reference ?? jni$_.jNullReference; + final _$is$ = is$?.reference ?? jni$_.jNullReference; + return _obtainStyledAttributes$1( + reference.pointer, + _id_obtainStyledAttributes$1.pointer, + _$attributeSet.pointer, + _$is$.pointer, + i, + i1, + ).object(); + } + + static final _id_obtainStyledAttributes$2 = Context._class.instanceMethodId( + r'obtainStyledAttributes', + r'(I[I)Landroid/content/res/TypedArray;', + ); + + static final _obtainStyledAttributes$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Pointer)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public final android.content.res.TypedArray obtainStyledAttributes(int i, int[] is)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? obtainStyledAttributes$2(core$_.int i, jni$_.JIntArray? is$) { + final _$is$ = is$?.reference ?? jni$_.jNullReference; + return _obtainStyledAttributes$2( + reference.pointer, + _id_obtainStyledAttributes$2.pointer, + i, + _$is$.pointer, + ).object(); + } + + static final _id_obtainStyledAttributes$3 = Context._class.instanceMethodId( + r'obtainStyledAttributes', + r'([I)Landroid/content/res/TypedArray;', + ); + + static final _obtainStyledAttributes$3 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public final android.content.res.TypedArray obtainStyledAttributes(int[] is)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? obtainStyledAttributes$3(jni$_.JIntArray? is$) { + final _$is$ = is$?.reference ?? jni$_.jNullReference; + return _obtainStyledAttributes$3( + reference.pointer, + _id_obtainStyledAttributes$3.pointer, + _$is$.pointer, + ).object(); + } + + static final _id_openFileInput = Context._class.instanceMethodId( + r'openFileInput', + r'(Ljava/lang/String;)Ljava/io/FileInputStream;', + ); + + static final _openFileInput = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract java.io.FileInputStream openFileInput(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? openFileInput(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _openFileInput( + reference.pointer, + _id_openFileInput.pointer, + _$string.pointer, + ).object(); + } + + static final _id_openFileOutput = Context._class.instanceMethodId( + r'openFileOutput', + r'(Ljava/lang/String;I)Ljava/io/FileOutputStream;', + ); + + static final _openFileOutput = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract java.io.FileOutputStream openFileOutput(java.lang.String string, int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? openFileOutput(jni$_.JString? string, core$_.int i) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _openFileOutput( + reference.pointer, + _id_openFileOutput.pointer, + _$string.pointer, + i, + ).object(); + } + + static final _id_openOrCreateDatabase = Context._class.instanceMethodId( + r'openOrCreateDatabase', + r'(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;)Landroid/database/sqlite/SQLiteDatabase;', + ); + + static final _openOrCreateDatabase = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String string, int i, android.database.sqlite.SQLiteDatabase$CursorFactory cursorFactory)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? openOrCreateDatabase( + jni$_.JString? string, + core$_.int i, + jni$_.JObject? cursorFactory, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$cursorFactory = cursorFactory?.reference ?? jni$_.jNullReference; + return _openOrCreateDatabase( + reference.pointer, + _id_openOrCreateDatabase.pointer, + _$string.pointer, + i, + _$cursorFactory.pointer, + ).object(); + } + + static final _id_openOrCreateDatabase$1 = Context._class.instanceMethodId( + r'openOrCreateDatabase', + r'(Ljava/lang/String;ILandroid/database/sqlite/SQLiteDatabase$CursorFactory;Landroid/database/DatabaseErrorHandler;)Landroid/database/sqlite/SQLiteDatabase;', + ); + + static final _openOrCreateDatabase$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(java.lang.String string, int i, android.database.sqlite.SQLiteDatabase$CursorFactory cursorFactory, android.database.DatabaseErrorHandler databaseErrorHandler)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? openOrCreateDatabase$1( + jni$_.JString? string, + core$_.int i, + jni$_.JObject? cursorFactory, + jni$_.JObject? databaseErrorHandler, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$cursorFactory = cursorFactory?.reference ?? jni$_.jNullReference; + final _$databaseErrorHandler = + databaseErrorHandler?.reference ?? jni$_.jNullReference; + return _openOrCreateDatabase$1( + reference.pointer, + _id_openOrCreateDatabase$1.pointer, + _$string.pointer, + i, + _$cursorFactory.pointer, + _$databaseErrorHandler.pointer, + ).object(); + } + + static final _id_peekWallpaper = Context._class.instanceMethodId( + r'peekWallpaper', + r'()Landroid/graphics/drawable/Drawable;', + ); + + static final _peekWallpaper = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public abstract android.graphics.drawable.Drawable peekWallpaper()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? peekWallpaper() { + return _peekWallpaper( + reference.pointer, + _id_peekWallpaper.pointer, + ).object(); + } + + static final _id_registerComponentCallbacks = Context._class.instanceMethodId( + r'registerComponentCallbacks', + r'(Landroid/content/ComponentCallbacks;)V', + ); + + static final _registerComponentCallbacks = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public void registerComponentCallbacks(android.content.ComponentCallbacks componentCallbacks)` + void registerComponentCallbacks(jni$_.JObject? componentCallbacks) { + final _$componentCallbacks = + componentCallbacks?.reference ?? jni$_.jNullReference; + _registerComponentCallbacks( + reference.pointer, + _id_registerComponentCallbacks.pointer, + _$componentCallbacks.pointer, + ).check(); + } + + static final _id_registerDeviceIdChangeListener = Context._class + .instanceMethodId( + r'registerDeviceIdChangeListener', + r'(Ljava/util/concurrent/Executor;Ljava/util/function/IntConsumer;)V', + ); + + static final _registerDeviceIdChangeListener = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void registerDeviceIdChangeListener(java.util.concurrent.Executor executor, java.util.function.IntConsumer intConsumer)` + void registerDeviceIdChangeListener( + jni$_.JObject? executor, + jni$_.JObject? intConsumer, + ) { + final _$executor = executor?.reference ?? jni$_.jNullReference; + final _$intConsumer = intConsumer?.reference ?? jni$_.jNullReference; + _registerDeviceIdChangeListener( + reference.pointer, + _id_registerDeviceIdChangeListener.pointer, + _$executor.pointer, + _$intConsumer.pointer, + ).check(); + } + + static final _id_registerReceiver = Context._class.instanceMethodId( + r'registerReceiver', + r'(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;', + ); + + static final _registerReceiver = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver broadcastReceiver, android.content.IntentFilter intentFilter)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? registerReceiver( + jni$_.JObject? broadcastReceiver, + jni$_.JObject? intentFilter, + ) { + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$intentFilter = intentFilter?.reference ?? jni$_.jNullReference; + return _registerReceiver( + reference.pointer, + _id_registerReceiver.pointer, + _$broadcastReceiver.pointer, + _$intentFilter.pointer, + ).object(); + } + + static final _id_registerReceiver$1 = Context._class.instanceMethodId( + r'registerReceiver', + r'(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;I)Landroid/content/Intent;', + ); + + static final _registerReceiver$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver broadcastReceiver, android.content.IntentFilter intentFilter, int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? registerReceiver$1( + jni$_.JObject? broadcastReceiver, + jni$_.JObject? intentFilter, + core$_.int i, + ) { + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$intentFilter = intentFilter?.reference ?? jni$_.jNullReference; + return _registerReceiver$1( + reference.pointer, + _id_registerReceiver$1.pointer, + _$broadcastReceiver.pointer, + _$intentFilter.pointer, + i, + ).object(); + } + + static final _id_registerReceiver$2 = Context._class.instanceMethodId( + r'registerReceiver', + r'(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;)Landroid/content/Intent;', + ); + + static final _registerReceiver$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver broadcastReceiver, android.content.IntentFilter intentFilter, java.lang.String string, android.os.Handler handler)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? registerReceiver$2( + jni$_.JObject? broadcastReceiver, + jni$_.JObject? intentFilter, + jni$_.JString? string, + jni$_.JObject? handler, + ) { + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$intentFilter = intentFilter?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + return _registerReceiver$2( + reference.pointer, + _id_registerReceiver$2.pointer, + _$broadcastReceiver.pointer, + _$intentFilter.pointer, + _$string.pointer, + _$handler.pointer, + ).object(); + } + + static final _id_registerReceiver$3 = Context._class.instanceMethodId( + r'registerReceiver', + r'(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;Ljava/lang/String;Landroid/os/Handler;I)Landroid/content/Intent;', + ); + + static final _registerReceiver$3 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver broadcastReceiver, android.content.IntentFilter intentFilter, java.lang.String string, android.os.Handler handler, int i)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? registerReceiver$3( + jni$_.JObject? broadcastReceiver, + jni$_.JObject? intentFilter, + jni$_.JString? string, + jni$_.JObject? handler, + core$_.int i, + ) { + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$intentFilter = intentFilter?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + return _registerReceiver$3( + reference.pointer, + _id_registerReceiver$3.pointer, + _$broadcastReceiver.pointer, + _$intentFilter.pointer, + _$string.pointer, + _$handler.pointer, + i, + ).object(); + } + + static final _id_removeStickyBroadcast = Context._class.instanceMethodId( + r'removeStickyBroadcast', + r'(Landroid/content/Intent;)V', + ); + + static final _removeStickyBroadcast = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void removeStickyBroadcast(android.content.Intent intent)` + void removeStickyBroadcast(jni$_.JObject? intent) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + _removeStickyBroadcast( + reference.pointer, + _id_removeStickyBroadcast.pointer, + _$intent.pointer, + ).check(); + } + + static final _id_removeStickyBroadcastAsUser = Context._class + .instanceMethodId( + r'removeStickyBroadcastAsUser', + r'(Landroid/content/Intent;Landroid/os/UserHandle;)V', + ); + + static final _removeStickyBroadcastAsUser = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void removeStickyBroadcastAsUser(android.content.Intent intent, android.os.UserHandle userHandle)` + void removeStickyBroadcastAsUser( + jni$_.JObject? intent, + jni$_.JObject? userHandle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + _removeStickyBroadcastAsUser( + reference.pointer, + _id_removeStickyBroadcastAsUser.pointer, + _$intent.pointer, + _$userHandle.pointer, + ).check(); + } + + static final _id_revokeSelfPermissionOnKill = Context._class.instanceMethodId( + r'revokeSelfPermissionOnKill', + r'(Ljava/lang/String;)V', + ); + + static final _revokeSelfPermissionOnKill = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public void revokeSelfPermissionOnKill(java.lang.String string)` + void revokeSelfPermissionOnKill(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + _revokeSelfPermissionOnKill( + reference.pointer, + _id_revokeSelfPermissionOnKill.pointer, + _$string.pointer, + ).check(); + } + + static final _id_revokeSelfPermissionsOnKill = Context._class + .instanceMethodId( + r'revokeSelfPermissionsOnKill', + r'(Ljava/util/Collection;)V', + ); + + static final _revokeSelfPermissionsOnKill = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public void revokeSelfPermissionsOnKill(java.util.Collection collection)` + void revokeSelfPermissionsOnKill(jni$_.JObject? collection) { + final _$collection = collection?.reference ?? jni$_.jNullReference; + _revokeSelfPermissionsOnKill( + reference.pointer, + _id_revokeSelfPermissionsOnKill.pointer, + _$collection.pointer, + ).check(); + } + + static final _id_revokeUriPermission = Context._class.instanceMethodId( + r'revokeUriPermission', + r'(Landroid/net/Uri;I)V', + ); + + static final _revokeUriPermission = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer, jni$_.Int32)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract void revokeUriPermission(android.net.Uri uri, int i)` + void revokeUriPermission(jni$_.JObject? uri, core$_.int i) { + final _$uri = uri?.reference ?? jni$_.jNullReference; + _revokeUriPermission( + reference.pointer, + _id_revokeUriPermission.pointer, + _$uri.pointer, + i, + ).check(); + } + + static final _id_revokeUriPermission$1 = Context._class.instanceMethodId( + r'revokeUriPermission', + r'(Ljava/lang/String;Landroid/net/Uri;I)V', + ); + + static final _revokeUriPermission$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + ) + >(); + + /// from: `public abstract void revokeUriPermission(java.lang.String string, android.net.Uri uri, int i)` + void revokeUriPermission$1( + jni$_.JString? string, + jni$_.JObject? uri, + core$_.int i, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$uri = uri?.reference ?? jni$_.jNullReference; + _revokeUriPermission$1( + reference.pointer, + _id_revokeUriPermission$1.pointer, + _$string.pointer, + _$uri.pointer, + i, + ).check(); + } + + static final _id_sendBroadcast = Context._class.instanceMethodId( + r'sendBroadcast', + r'(Landroid/content/Intent;)V', + ); + + static final _sendBroadcast = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendBroadcast(android.content.Intent intent)` + void sendBroadcast(jni$_.JObject? intent) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + _sendBroadcast( + reference.pointer, + _id_sendBroadcast.pointer, + _$intent.pointer, + ).check(); + } + + static final _id_sendBroadcast$1 = Context._class.instanceMethodId( + r'sendBroadcast', + r'(Landroid/content/Intent;Ljava/lang/String;)V', + ); + + static final _sendBroadcast$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendBroadcast(android.content.Intent intent, java.lang.String string)` + void sendBroadcast$1(jni$_.JObject? intent, jni$_.JString? string) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + _sendBroadcast$1( + reference.pointer, + _id_sendBroadcast$1.pointer, + _$intent.pointer, + _$string.pointer, + ).check(); + } + + static final _id_sendBroadcast$2 = Context._class.instanceMethodId( + r'sendBroadcast', + r'(Landroid/content/Intent;Ljava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendBroadcast$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void sendBroadcast(android.content.Intent intent, java.lang.String string, android.os.Bundle bundle)` + void sendBroadcast$2( + jni$_.JObject? intent, + jni$_.JString? string, + jni$_.JObject? bundle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendBroadcast$2( + reference.pointer, + _id_sendBroadcast$2.pointer, + _$intent.pointer, + _$string.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_sendBroadcastAsUser = Context._class.instanceMethodId( + r'sendBroadcastAsUser', + r'(Landroid/content/Intent;Landroid/os/UserHandle;)V', + ); + + static final _sendBroadcastAsUser = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendBroadcastAsUser(android.content.Intent intent, android.os.UserHandle userHandle)` + void sendBroadcastAsUser(jni$_.JObject? intent, jni$_.JObject? userHandle) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + _sendBroadcastAsUser( + reference.pointer, + _id_sendBroadcastAsUser.pointer, + _$intent.pointer, + _$userHandle.pointer, + ).check(); + } + + static final _id_sendBroadcastAsUser$1 = Context._class.instanceMethodId( + r'sendBroadcastAsUser', + r'(Landroid/content/Intent;Landroid/os/UserHandle;Ljava/lang/String;)V', + ); + + static final _sendBroadcastAsUser$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendBroadcastAsUser(android.content.Intent intent, android.os.UserHandle userHandle, java.lang.String string)` + void sendBroadcastAsUser$1( + jni$_.JObject? intent, + jni$_.JObject? userHandle, + jni$_.JString? string, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + _sendBroadcastAsUser$1( + reference.pointer, + _id_sendBroadcastAsUser$1.pointer, + _$intent.pointer, + _$userHandle.pointer, + _$string.pointer, + ).check(); + } + + static final _id_sendBroadcastWithMultiplePermissions = Context._class + .instanceMethodId( + r'sendBroadcastWithMultiplePermissions', + r'(Landroid/content/Intent;[Ljava/lang/String;)V', + ); + + static final _sendBroadcastWithMultiplePermissions = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void sendBroadcastWithMultiplePermissions(android.content.Intent intent, java.lang.String[] strings)` + void sendBroadcastWithMultiplePermissions( + jni$_.JObject? intent, + jni$_.JArray? strings, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$strings = strings?.reference ?? jni$_.jNullReference; + _sendBroadcastWithMultiplePermissions( + reference.pointer, + _id_sendBroadcastWithMultiplePermissions.pointer, + _$intent.pointer, + _$strings.pointer, + ).check(); + } + + static final _id_sendOrderedBroadcast = Context._class.instanceMethodId( + r'sendOrderedBroadcast', + r'(Landroid/content/Intent;Ljava/lang/String;)V', + ); + + static final _sendOrderedBroadcast = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendOrderedBroadcast(android.content.Intent intent, java.lang.String string)` + void sendOrderedBroadcast(jni$_.JObject? intent, jni$_.JString? string) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + _sendOrderedBroadcast( + reference.pointer, + _id_sendOrderedBroadcast.pointer, + _$intent.pointer, + _$string.pointer, + ).check(); + } + + static final _id_sendOrderedBroadcast$1 = Context._class.instanceMethodId( + r'sendOrderedBroadcast', + r'(Landroid/content/Intent;Ljava/lang/String;Landroid/content/BroadcastReceiver;Landroid/os/Handler;ILjava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendOrderedBroadcast$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendOrderedBroadcast(android.content.Intent intent, java.lang.String string, android.content.BroadcastReceiver broadcastReceiver, android.os.Handler handler, int i, java.lang.String string1, android.os.Bundle bundle)` + void sendOrderedBroadcast$1( + jni$_.JObject? intent, + jni$_.JString? string, + jni$_.JObject? broadcastReceiver, + jni$_.JObject? handler, + core$_.int i, + jni$_.JString? string1, + jni$_.JObject? bundle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendOrderedBroadcast$1( + reference.pointer, + _id_sendOrderedBroadcast$1.pointer, + _$intent.pointer, + _$string.pointer, + _$broadcastReceiver.pointer, + _$handler.pointer, + i, + _$string1.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_sendOrderedBroadcast$2 = Context._class.instanceMethodId( + r'sendOrderedBroadcast', + r'(Landroid/content/Intent;Ljava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendOrderedBroadcast$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void sendOrderedBroadcast(android.content.Intent intent, java.lang.String string, android.os.Bundle bundle)` + void sendOrderedBroadcast$2( + jni$_.JObject? intent, + jni$_.JString? string, + jni$_.JObject? bundle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendOrderedBroadcast$2( + reference.pointer, + _id_sendOrderedBroadcast$2.pointer, + _$intent.pointer, + _$string.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_sendOrderedBroadcast$3 = Context._class.instanceMethodId( + r'sendOrderedBroadcast', + r'(Landroid/content/Intent;Ljava/lang/String;Landroid/os/Bundle;Landroid/content/BroadcastReceiver;Landroid/os/Handler;ILjava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendOrderedBroadcast$3 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void sendOrderedBroadcast(android.content.Intent intent, java.lang.String string, android.os.Bundle bundle, android.content.BroadcastReceiver broadcastReceiver, android.os.Handler handler, int i, java.lang.String string1, android.os.Bundle bundle1)` + void sendOrderedBroadcast$3( + jni$_.JObject? intent, + jni$_.JString? string, + jni$_.JObject? bundle, + jni$_.JObject? broadcastReceiver, + jni$_.JObject? handler, + core$_.int i, + jni$_.JString? string1, + jni$_.JObject? bundle1, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + final _$bundle1 = bundle1?.reference ?? jni$_.jNullReference; + _sendOrderedBroadcast$3( + reference.pointer, + _id_sendOrderedBroadcast$3.pointer, + _$intent.pointer, + _$string.pointer, + _$bundle.pointer, + _$broadcastReceiver.pointer, + _$handler.pointer, + i, + _$string1.pointer, + _$bundle1.pointer, + ).check(); + } + + static final _id_sendOrderedBroadcast$4 = Context._class.instanceMethodId( + r'sendOrderedBroadcast', + r'(Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;Landroid/content/BroadcastReceiver;Landroid/os/Handler;ILjava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendOrderedBroadcast$4 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void sendOrderedBroadcast(android.content.Intent intent, java.lang.String string, java.lang.String string1, android.content.BroadcastReceiver broadcastReceiver, android.os.Handler handler, int i, java.lang.String string2, android.os.Bundle bundle)` + void sendOrderedBroadcast$4( + jni$_.JObject? intent, + jni$_.JString? string, + jni$_.JString? string1, + jni$_.JObject? broadcastReceiver, + jni$_.JObject? handler, + core$_.int i, + jni$_.JString? string2, + jni$_.JObject? bundle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + final _$string2 = string2?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendOrderedBroadcast$4( + reference.pointer, + _id_sendOrderedBroadcast$4.pointer, + _$intent.pointer, + _$string.pointer, + _$string1.pointer, + _$broadcastReceiver.pointer, + _$handler.pointer, + i, + _$string2.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_sendOrderedBroadcastAsUser = Context._class.instanceMethodId( + r'sendOrderedBroadcastAsUser', + r'(Landroid/content/Intent;Landroid/os/UserHandle;Ljava/lang/String;Landroid/content/BroadcastReceiver;Landroid/os/Handler;ILjava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendOrderedBroadcastAsUser = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendOrderedBroadcastAsUser(android.content.Intent intent, android.os.UserHandle userHandle, java.lang.String string, android.content.BroadcastReceiver broadcastReceiver, android.os.Handler handler, int i, java.lang.String string1, android.os.Bundle bundle)` + void sendOrderedBroadcastAsUser( + jni$_.JObject? intent, + jni$_.JObject? userHandle, + jni$_.JString? string, + jni$_.JObject? broadcastReceiver, + jni$_.JObject? handler, + core$_.int i, + jni$_.JString? string1, + jni$_.JObject? bundle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendOrderedBroadcastAsUser( + reference.pointer, + _id_sendOrderedBroadcastAsUser.pointer, + _$intent.pointer, + _$userHandle.pointer, + _$string.pointer, + _$broadcastReceiver.pointer, + _$handler.pointer, + i, + _$string1.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_sendStickyBroadcast = Context._class.instanceMethodId( + r'sendStickyBroadcast', + r'(Landroid/content/Intent;)V', + ); + + static final _sendStickyBroadcast = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendStickyBroadcast(android.content.Intent intent)` + void sendStickyBroadcast(jni$_.JObject? intent) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + _sendStickyBroadcast( + reference.pointer, + _id_sendStickyBroadcast.pointer, + _$intent.pointer, + ).check(); + } + + static final _id_sendStickyBroadcast$1 = Context._class.instanceMethodId( + r'sendStickyBroadcast', + r'(Landroid/content/Intent;Landroid/os/Bundle;)V', + ); + + static final _sendStickyBroadcast$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void sendStickyBroadcast(android.content.Intent intent, android.os.Bundle bundle)` + void sendStickyBroadcast$1(jni$_.JObject? intent, jni$_.JObject? bundle) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendStickyBroadcast$1( + reference.pointer, + _id_sendStickyBroadcast$1.pointer, + _$intent.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_sendStickyBroadcastAsUser = Context._class.instanceMethodId( + r'sendStickyBroadcastAsUser', + r'(Landroid/content/Intent;Landroid/os/UserHandle;)V', + ); + + static final _sendStickyBroadcastAsUser = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendStickyBroadcastAsUser(android.content.Intent intent, android.os.UserHandle userHandle)` + void sendStickyBroadcastAsUser( + jni$_.JObject? intent, + jni$_.JObject? userHandle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + _sendStickyBroadcastAsUser( + reference.pointer, + _id_sendStickyBroadcastAsUser.pointer, + _$intent.pointer, + _$userHandle.pointer, + ).check(); + } + + static final _id_sendStickyOrderedBroadcast = Context._class.instanceMethodId( + r'sendStickyOrderedBroadcast', + r'(Landroid/content/Intent;Landroid/content/BroadcastReceiver;Landroid/os/Handler;ILjava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendStickyOrderedBroadcast = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendStickyOrderedBroadcast(android.content.Intent intent, android.content.BroadcastReceiver broadcastReceiver, android.os.Handler handler, int i, java.lang.String string, android.os.Bundle bundle)` + void sendStickyOrderedBroadcast( + jni$_.JObject? intent, + jni$_.JObject? broadcastReceiver, + jni$_.JObject? handler, + core$_.int i, + jni$_.JString? string, + jni$_.JObject? bundle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendStickyOrderedBroadcast( + reference.pointer, + _id_sendStickyOrderedBroadcast.pointer, + _$intent.pointer, + _$broadcastReceiver.pointer, + _$handler.pointer, + i, + _$string.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_sendStickyOrderedBroadcastAsUser = Context._class + .instanceMethodId( + r'sendStickyOrderedBroadcastAsUser', + r'(Landroid/content/Intent;Landroid/os/UserHandle;Landroid/content/BroadcastReceiver;Landroid/os/Handler;ILjava/lang/String;Landroid/os/Bundle;)V', + ); + + static final _sendStickyOrderedBroadcastAsUser = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void sendStickyOrderedBroadcastAsUser(android.content.Intent intent, android.os.UserHandle userHandle, android.content.BroadcastReceiver broadcastReceiver, android.os.Handler handler, int i, java.lang.String string, android.os.Bundle bundle)` + void sendStickyOrderedBroadcastAsUser( + jni$_.JObject? intent, + jni$_.JObject? userHandle, + jni$_.JObject? broadcastReceiver, + jni$_.JObject? handler, + core$_.int i, + jni$_.JString? string, + jni$_.JObject? bundle, + ) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$userHandle = userHandle?.reference ?? jni$_.jNullReference; + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + final _$handler = handler?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _sendStickyOrderedBroadcastAsUser( + reference.pointer, + _id_sendStickyOrderedBroadcastAsUser.pointer, + _$intent.pointer, + _$userHandle.pointer, + _$broadcastReceiver.pointer, + _$handler.pointer, + i, + _$string.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_set$theme$1 = Context._class.instanceMethodId( + r'setTheme', + r'(I)V', + ); + + static final _set$theme$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public abstract void setTheme(int i)` + set theme$1(core$_.int i) { + _set$theme$1(reference.pointer, _id_set$theme$1.pointer, i).check(); + } + + static final _id_set$wallpaper$1 = Context._class.instanceMethodId( + r'setWallpaper', + r'(Landroid/graphics/Bitmap;)V', + ); + + static final _set$wallpaper$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void setWallpaper(android.graphics.Bitmap bitmap)` + set wallpaper$1(jni$_.JObject? bitmap) { + final _$bitmap = bitmap?.reference ?? jni$_.jNullReference; + _set$wallpaper$1( + reference.pointer, + _id_set$wallpaper$1.pointer, + _$bitmap.pointer, + ).check(); + } + + static final _id_set$wallpaper$2 = Context._class.instanceMethodId( + r'setWallpaper', + r'(Ljava/io/InputStream;)V', + ); + + static final _set$wallpaper$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void setWallpaper(java.io.InputStream inputStream)` + set wallpaper$2(jni$_.JObject? inputStream) { + final _$inputStream = inputStream?.reference ?? jni$_.jNullReference; + _set$wallpaper$2( + reference.pointer, + _id_set$wallpaper$2.pointer, + _$inputStream.pointer, + ).check(); + } + + static final _id_startActivities = Context._class.instanceMethodId( + r'startActivities', + r'([Landroid/content/Intent;)V', + ); + + static final _startActivities = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void startActivities(android.content.Intent[] intents)` + void startActivities(jni$_.JArray? intents) { + final _$intents = intents?.reference ?? jni$_.jNullReference; + _startActivities( + reference.pointer, + _id_startActivities.pointer, + _$intents.pointer, + ).check(); + } + + static final _id_startActivities$1 = Context._class.instanceMethodId( + r'startActivities', + r'([Landroid/content/Intent;Landroid/os/Bundle;)V', + ); + + static final _startActivities$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void startActivities(android.content.Intent[] intents, android.os.Bundle bundle)` + void startActivities$1( + jni$_.JArray? intents, + jni$_.JObject? bundle, + ) { + final _$intents = intents?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _startActivities$1( + reference.pointer, + _id_startActivities$1.pointer, + _$intents.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_startActivity = Context._class.instanceMethodId( + r'startActivity', + r'(Landroid/content/Intent;)V', + ); + + static final _startActivity = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void startActivity(android.content.Intent intent)` + void startActivity(jni$_.JObject? intent) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + _startActivity( + reference.pointer, + _id_startActivity.pointer, + _$intent.pointer, + ).check(); + } + + static final _id_startActivity$1 = Context._class.instanceMethodId( + r'startActivity', + r'(Landroid/content/Intent;Landroid/os/Bundle;)V', + ); + + static final _startActivity$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void startActivity(android.content.Intent intent, android.os.Bundle bundle)` + void startActivity$1(jni$_.JObject? intent, jni$_.JObject? bundle) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _startActivity$1( + reference.pointer, + _id_startActivity$1.pointer, + _$intent.pointer, + _$bundle.pointer, + ).check(); + } + + static final _id_startForegroundService = Context._class.instanceMethodId( + r'startForegroundService', + r'(Landroid/content/Intent;)Landroid/content/ComponentName;', + ); + + static final _startForegroundService = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.content.ComponentName startForegroundService(android.content.Intent intent)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? startForegroundService(jni$_.JObject? intent) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + return _startForegroundService( + reference.pointer, + _id_startForegroundService.pointer, + _$intent.pointer, + ).object(); + } + + static final _id_startInstrumentation = Context._class.instanceMethodId( + r'startInstrumentation', + r'(Landroid/content/ComponentName;Ljava/lang/String;Landroid/os/Bundle;)Z', + ); + + static final _startInstrumentation = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract boolean startInstrumentation(android.content.ComponentName componentName, java.lang.String string, android.os.Bundle bundle)` + core$_.bool startInstrumentation( + jni$_.JObject? componentName, + jni$_.JString? string, + jni$_.JObject? bundle, + ) { + final _$componentName = componentName?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + return _startInstrumentation( + reference.pointer, + _id_startInstrumentation.pointer, + _$componentName.pointer, + _$string.pointer, + _$bundle.pointer, + ).boolean; + } + + static final _id_startIntentSender = Context._class.instanceMethodId( + r'startIntentSender', + r'(Landroid/content/IntentSender;Landroid/content/Intent;III)V', + ); + + static final _startIntentSender = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public abstract void startIntentSender(android.content.IntentSender intentSender, android.content.Intent intent, int i, int i1, int i2)` + void startIntentSender( + jni$_.JObject? intentSender, + jni$_.JObject? intent, + core$_.int i, + core$_.int i1, + core$_.int i2, + ) { + final _$intentSender = intentSender?.reference ?? jni$_.jNullReference; + final _$intent = intent?.reference ?? jni$_.jNullReference; + _startIntentSender( + reference.pointer, + _id_startIntentSender.pointer, + _$intentSender.pointer, + _$intent.pointer, + i, + i1, + i2, + ).check(); + } + + static final _id_startIntentSender$1 = Context._class.instanceMethodId( + r'startIntentSender', + r'(Landroid/content/IntentSender;Landroid/content/Intent;IIILandroid/os/Bundle;)V', + ); + + static final _startIntentSender$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + core$_.int, + core$_.int, + core$_.int, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void startIntentSender(android.content.IntentSender intentSender, android.content.Intent intent, int i, int i1, int i2, android.os.Bundle bundle)` + void startIntentSender$1( + jni$_.JObject? intentSender, + jni$_.JObject? intent, + core$_.int i, + core$_.int i1, + core$_.int i2, + jni$_.JObject? bundle, + ) { + final _$intentSender = intentSender?.reference ?? jni$_.jNullReference; + final _$intent = intent?.reference ?? jni$_.jNullReference; + final _$bundle = bundle?.reference ?? jni$_.jNullReference; + _startIntentSender$1( + reference.pointer, + _id_startIntentSender$1.pointer, + _$intentSender.pointer, + _$intent.pointer, + i, + i1, + i2, + _$bundle.pointer, + ).check(); + } + + static final _id_startService = Context._class.instanceMethodId( + r'startService', + r'(Landroid/content/Intent;)Landroid/content/ComponentName;', + ); + + static final _startService = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract android.content.ComponentName startService(android.content.Intent intent)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? startService(jni$_.JObject? intent) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + return _startService( + reference.pointer, + _id_startService.pointer, + _$intent.pointer, + ).object(); + } + + static final _id_stopService = Context._class.instanceMethodId( + r'stopService', + r'(Landroid/content/Intent;)Z', + ); + + static final _stopService = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract boolean stopService(android.content.Intent intent)` + core$_.bool stopService(jni$_.JObject? intent) { + final _$intent = intent?.reference ?? jni$_.jNullReference; + return _stopService( + reference.pointer, + _id_stopService.pointer, + _$intent.pointer, + ).boolean; + } + + static final _id_unbindService = Context._class.instanceMethodId( + r'unbindService', + r'(Landroid/content/ServiceConnection;)V', + ); + + static final _unbindService = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void unbindService(android.content.ServiceConnection serviceConnection)` + void unbindService(jni$_.JObject? serviceConnection) { + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + _unbindService( + reference.pointer, + _id_unbindService.pointer, + _$serviceConnection.pointer, + ).check(); + } + + static final _id_unregisterComponentCallbacks = Context._class + .instanceMethodId( + r'unregisterComponentCallbacks', + r'(Landroid/content/ComponentCallbacks;)V', + ); + + static final _unregisterComponentCallbacks = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public void unregisterComponentCallbacks(android.content.ComponentCallbacks componentCallbacks)` + void unregisterComponentCallbacks(jni$_.JObject? componentCallbacks) { + final _$componentCallbacks = + componentCallbacks?.reference ?? jni$_.jNullReference; + _unregisterComponentCallbacks( + reference.pointer, + _id_unregisterComponentCallbacks.pointer, + _$componentCallbacks.pointer, + ).check(); + } + + static final _id_unregisterDeviceIdChangeListener = Context._class + .instanceMethodId( + r'unregisterDeviceIdChangeListener', + r'(Ljava/util/function/IntConsumer;)V', + ); + + static final _unregisterDeviceIdChangeListener = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public void unregisterDeviceIdChangeListener(java.util.function.IntConsumer intConsumer)` + void unregisterDeviceIdChangeListener(jni$_.JObject? intConsumer) { + final _$intConsumer = intConsumer?.reference ?? jni$_.jNullReference; + _unregisterDeviceIdChangeListener( + reference.pointer, + _id_unregisterDeviceIdChangeListener.pointer, + _$intConsumer.pointer, + ).check(); + } + + static final _id_unregisterReceiver = Context._class.instanceMethodId( + r'unregisterReceiver', + r'(Landroid/content/BroadcastReceiver;)V', + ); + + static final _unregisterReceiver = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public abstract void unregisterReceiver(android.content.BroadcastReceiver broadcastReceiver)` + void unregisterReceiver(jni$_.JObject? broadcastReceiver) { + final _$broadcastReceiver = + broadcastReceiver?.reference ?? jni$_.jNullReference; + _unregisterReceiver( + reference.pointer, + _id_unregisterReceiver.pointer, + _$broadcastReceiver.pointer, + ).check(); + } + + static final _id_updateServiceGroup = Context._class.instanceMethodId( + r'updateServiceGroup', + r'(Landroid/content/ServiceConnection;II)V', + ); + + static final _updateServiceGroup = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Int32, jni$_.Int32) + >, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public void updateServiceGroup(android.content.ServiceConnection serviceConnection, int i, int i1)` + void updateServiceGroup( + jni$_.JObject? serviceConnection, + core$_.int i, + core$_.int i1, + ) { + final _$serviceConnection = + serviceConnection?.reference ?? jni$_.jNullReference; + _updateServiceGroup( + reference.pointer, + _id_updateServiceGroup.pointer, + _$serviceConnection.pointer, + i, + i1, + ).check(); + } +} + +final class $Context$Type$ extends jni$_.JType { + @jni$_.internal + const $Context$Type$(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroid/content/Context;'; +} + +/// from: `java.io.File` +extension type File._(jni$_.JObject _$this) implements jni$_.JObject { + static final _class = jni$_.JClass.forName(r'java/io/File'); + + /// The type which includes information such as the signature of this class. + static const jni$_.JType type = $File$Type$(); + static final _id_pathSeparator = _class.staticFieldId( + r'pathSeparator', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String pathSeparator` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get pathSeparator => + _id_pathSeparator.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_pathSeparatorChar = _class.staticFieldId( + r'pathSeparatorChar', + r'C', + ); + + /// from: `static public final char pathSeparatorChar` + static core$_.int get pathSeparatorChar => + _id_pathSeparatorChar.getNullable(_class, jni$_.jchar.type) as core$_.int; + + static final _id_separator = _class.staticFieldId( + r'separator', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String separator` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get separator => + _id_separator.getNullable(_class, jni$_.JString.type) as jni$_.JString?; + + static final _id_separatorChar = _class.staticFieldId(r'separatorChar', r'C'); + + /// from: `static public final char separatorChar` + static core$_.int get separatorChar => + _id_separatorChar.getNullable(_class, jni$_.jchar.type) as core$_.int; + + static final _id_new$ = _class.constructorId( + r'(Ljava/io/File;Ljava/lang/String;)V', + ); + + static final _new$ = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void (java.io.File file, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory File(File? file, jni$_.JString? string) { + final _$file = file?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + return _new$( + _class.reference.pointer, + _id_new$.pointer, + _$file.pointer, + _$string.pointer, + ).object(); + } + + static final _id_new$1 = _class.constructorId(r'(Ljava/lang/String;)V'); + + static final _new$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public void (java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory File.new$1(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _new$1( + _class.reference.pointer, + _id_new$1.pointer, + _$string.pointer, + ).object(); + } + + static final _id_new$2 = _class.constructorId( + r'(Ljava/lang/String;Ljava/lang/String;)V', + ); + + static final _new$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `public void (java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + factory File.new$2(jni$_.JString? string, jni$_.JString? string1) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + return _new$2( + _class.reference.pointer, + _id_new$2.pointer, + _$string.pointer, + _$string1.pointer, + ).object(); + } + + static final _id_new$3 = _class.constructorId(r'(Ljava/net/URI;)V'); + + static final _new$3 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public void (java.net.URI uRI)` + /// The returned object must be released after use, by calling the [release] method. + factory File.new$3(jni$_.JObject? uRI) { + final _$uRI = uRI?.reference ?? jni$_.jNullReference; + return _new$3( + _class.reference.pointer, + _id_new$3.pointer, + _$uRI.pointer, + ).object(); + } + + static final _id_createTempFile = _class.staticMethodId( + r'createTempFile', + r'(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;', + ); + + static final _createTempFile = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + (jni$_.Pointer, jni$_.Pointer) + >, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `static public java.io.File createTempFile(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + static File? createTempFile(jni$_.JString? string, jni$_.JString? string1) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + return _createTempFile( + _class.reference.pointer, + _id_createTempFile.pointer, + _$string.pointer, + _$string1.pointer, + ).object(); + } + + static final _id_createTempFile$1 = _class.staticMethodId( + r'createTempFile', + r'(Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Ljava/io/File;', + ); + + static final _createTempFile$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + ) + >(); + + /// from: `static public java.io.File createTempFile(java.lang.String string, java.lang.String string1, java.io.File file)` + /// The returned object must be released after use, by calling the [release] method. + static File? createTempFile$1( + jni$_.JString? string, + jni$_.JString? string1, + File? file, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + final _$file = file?.reference ?? jni$_.jNullReference; + return _createTempFile$1( + _class.reference.pointer, + _id_createTempFile$1.pointer, + _$string.pointer, + _$string1.pointer, + _$file.pointer, + ).object(); + } + + static final _id_listRoots = _class.staticMethodId( + r'listRoots', + r'()[Ljava/io/File;', + ); + + static final _listRoots = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public java.io.File[] listRoots()` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JArray? listRoots() { + return _listRoots( + _class.reference.pointer, + _id_listRoots.pointer, + ).object?>(); + } +} + +extension File$$Methods on File { + static final _id_canExecute = File._class.instanceMethodId( + r'canExecute', + r'()Z', + ); + + static final _canExecute = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean canExecute()` + core$_.bool canExecute() { + return _canExecute(reference.pointer, _id_canExecute.pointer).boolean; + } + + static final _id_canRead = File._class.instanceMethodId(r'canRead', r'()Z'); + + static final _canRead = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean canRead()` + core$_.bool canRead() { + return _canRead(reference.pointer, _id_canRead.pointer).boolean; + } + + static final _id_canWrite = File._class.instanceMethodId(r'canWrite', r'()Z'); + + static final _canWrite = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean canWrite()` + core$_.bool canWrite() { + return _canWrite(reference.pointer, _id_canWrite.pointer).boolean; + } + + static final _id_compareTo = File._class.instanceMethodId( + r'compareTo', + r'(Ljava/io/File;)I', + ); + + static final _compareTo = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public int compareTo(java.io.File file)` + core$_.int compareTo(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _compareTo( + reference.pointer, + _id_compareTo.pointer, + _$file.pointer, + ).integer; + } + + static final _id_createNewFile = File._class.instanceMethodId( + r'createNewFile', + r'()Z', + ); + + static final _createNewFile = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean createNewFile()` + core$_.bool createNewFile() { + return _createNewFile(reference.pointer, _id_createNewFile.pointer).boolean; + } + + static final _id_delete = File._class.instanceMethodId(r'delete', r'()Z'); + + static final _delete = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean delete()` + core$_.bool delete() { + return _delete(reference.pointer, _id_delete.pointer).boolean; + } + + static final _id_deleteOnExit = File._class.instanceMethodId( + r'deleteOnExit', + r'()V', + ); + + static final _deleteOnExit = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public void deleteOnExit()` + void deleteOnExit() { + _deleteOnExit(reference.pointer, _id_deleteOnExit.pointer).check(); + } + + static final _id_equals = File._class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean equals(java.lang.Object object)` + core$_.bool equals(jni$_.JObject? object) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _equals( + reference.pointer, + _id_equals.pointer, + _$object.pointer, + ).boolean; + } + + static final _id_exists = File._class.instanceMethodId(r'exists', r'()Z'); + + static final _exists = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean exists()` + core$_.bool exists() { + return _exists(reference.pointer, _id_exists.pointer).boolean; + } + + static final _id_get$absoluteFile = File._class.instanceMethodId( + r'getAbsoluteFile', + r'()Ljava/io/File;', + ); + + static final _get$absoluteFile = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.io.File getAbsoluteFile()` + /// The returned object must be released after use, by calling the [release] method. + File? get absoluteFile { + return _get$absoluteFile( + reference.pointer, + _id_get$absoluteFile.pointer, + ).object(); + } + + static final _id_get$absolutePath = File._class.instanceMethodId( + r'getAbsolutePath', + r'()Ljava/lang/String;', + ); + + static final _get$absolutePath = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String getAbsolutePath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get absolutePath { + return _get$absolutePath( + reference.pointer, + _id_get$absolutePath.pointer, + ).object(); + } + + static final _id_get$canonicalFile = File._class.instanceMethodId( + r'getCanonicalFile', + r'()Ljava/io/File;', + ); + + static final _get$canonicalFile = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.io.File getCanonicalFile()` + /// The returned object must be released after use, by calling the [release] method. + File? get canonicalFile { + return _get$canonicalFile( + reference.pointer, + _id_get$canonicalFile.pointer, + ).object(); + } + + static final _id_get$canonicalPath = File._class.instanceMethodId( + r'getCanonicalPath', + r'()Ljava/lang/String;', + ); + + static final _get$canonicalPath = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String getCanonicalPath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get canonicalPath { + return _get$canonicalPath( + reference.pointer, + _id_get$canonicalPath.pointer, + ).object(); + } + + static final _id_get$freeSpace = File._class.instanceMethodId( + r'getFreeSpace', + r'()J', + ); + + static final _get$freeSpace = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public long getFreeSpace()` + core$_.int get freeSpace { + return _get$freeSpace(reference.pointer, _id_get$freeSpace.pointer).long; + } + + static final _id_get$name = File._class.instanceMethodId( + r'getName', + r'()Ljava/lang/String;', + ); + + static final _get$name = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String getName()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get name { + return _get$name( + reference.pointer, + _id_get$name.pointer, + ).object(); + } + + static final _id_get$parent = File._class.instanceMethodId( + r'getParent', + r'()Ljava/lang/String;', + ); + + static final _get$parent = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String getParent()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get parent { + return _get$parent( + reference.pointer, + _id_get$parent.pointer, + ).object(); + } + + static final _id_get$parentFile = File._class.instanceMethodId( + r'getParentFile', + r'()Ljava/io/File;', + ); + + static final _get$parentFile = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.io.File getParentFile()` + /// The returned object must be released after use, by calling the [release] method. + File? get parentFile { + return _get$parentFile( + reference.pointer, + _id_get$parentFile.pointer, + ).object(); + } + + static final _id_get$path = File._class.instanceMethodId( + r'getPath', + r'()Ljava/lang/String;', + ); + + static final _get$path = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String getPath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? get path { + return _get$path( + reference.pointer, + _id_get$path.pointer, + ).object(); + } + + static final _id_get$totalSpace = File._class.instanceMethodId( + r'getTotalSpace', + r'()J', + ); + + static final _get$totalSpace = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public long getTotalSpace()` + core$_.int get totalSpace { + return _get$totalSpace(reference.pointer, _id_get$totalSpace.pointer).long; + } + + static final _id_get$usableSpace = File._class.instanceMethodId( + r'getUsableSpace', + r'()J', + ); + + static final _get$usableSpace = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public long getUsableSpace()` + core$_.int get usableSpace { + return _get$usableSpace( + reference.pointer, + _id_get$usableSpace.pointer, + ).long; + } + + static final _id_hashCode$1 = File._class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public int hashCode()` + core$_.int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1.pointer).integer; + } + + static final _id_get$isAbsolute = File._class.instanceMethodId( + r'isAbsolute', + r'()Z', + ); + + static final _get$isAbsolute = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean isAbsolute()` + core$_.bool get isAbsolute { + return _get$isAbsolute( + reference.pointer, + _id_get$isAbsolute.pointer, + ).boolean; + } + + static final _id_get$isDirectory = File._class.instanceMethodId( + r'isDirectory', + r'()Z', + ); + + static final _get$isDirectory = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean isDirectory()` + core$_.bool get isDirectory { + return _get$isDirectory( + reference.pointer, + _id_get$isDirectory.pointer, + ).boolean; + } + + static final _id_get$isFile = File._class.instanceMethodId(r'isFile', r'()Z'); + + static final _get$isFile = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean isFile()` + core$_.bool get isFile { + return _get$isFile(reference.pointer, _id_get$isFile.pointer).boolean; + } + + static final _id_get$isHidden = File._class.instanceMethodId( + r'isHidden', + r'()Z', + ); + + static final _get$isHidden = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean isHidden()` + core$_.bool get isHidden { + return _get$isHidden(reference.pointer, _id_get$isHidden.pointer).boolean; + } + + static final _id_lastModified = File._class.instanceMethodId( + r'lastModified', + r'()J', + ); + + static final _lastModified = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public long lastModified()` + core$_.int lastModified() { + return _lastModified(reference.pointer, _id_lastModified.pointer).long; + } + + static final _id_length = File._class.instanceMethodId(r'length', r'()J'); + + static final _length = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public long length()` + core$_.int length() { + return _length(reference.pointer, _id_length.pointer).long; + } + + static final _id_list = File._class.instanceMethodId( + r'list', + r'()[Ljava/lang/String;', + ); + + static final _list = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String[] list()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? list() { + return _list( + reference.pointer, + _id_list.pointer, + ).object?>(); + } + + static final _id_list$1 = File._class.instanceMethodId( + r'list', + r'(Ljava/io/FilenameFilter;)[Ljava/lang/String;', + ); + + static final _list$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public java.lang.String[] list(java.io.FilenameFilter filenameFilter)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? list$1(jni$_.JObject? filenameFilter) { + final _$filenameFilter = filenameFilter?.reference ?? jni$_.jNullReference; + return _list$1( + reference.pointer, + _id_list$1.pointer, + _$filenameFilter.pointer, + ).object?>(); + } + + static final _id_listFiles = File._class.instanceMethodId( + r'listFiles', + r'()[Ljava/io/File;', + ); + + static final _listFiles = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.io.File[] listFiles()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? listFiles() { + return _listFiles( + reference.pointer, + _id_listFiles.pointer, + ).object?>(); + } + + static final _id_listFiles$1 = File._class.instanceMethodId( + r'listFiles', + r'(Ljava/io/FileFilter;)[Ljava/io/File;', + ); + + static final _listFiles$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public java.io.File[] listFiles(java.io.FileFilter fileFilter)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? listFiles$1(jni$_.JObject? fileFilter) { + final _$fileFilter = fileFilter?.reference ?? jni$_.jNullReference; + return _listFiles$1( + reference.pointer, + _id_listFiles$1.pointer, + _$fileFilter.pointer, + ).object?>(); + } + + static final _id_listFiles$2 = File._class.instanceMethodId( + r'listFiles', + r'(Ljava/io/FilenameFilter;)[Ljava/io/File;', + ); + + static final _listFiles$2 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public java.io.File[] listFiles(java.io.FilenameFilter filenameFilter)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? listFiles$2(jni$_.JObject? filenameFilter) { + final _$filenameFilter = filenameFilter?.reference ?? jni$_.jNullReference; + return _listFiles$2( + reference.pointer, + _id_listFiles$2.pointer, + _$filenameFilter.pointer, + ).object?>(); + } + + static final _id_mkdir = File._class.instanceMethodId(r'mkdir', r'()Z'); + + static final _mkdir = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean mkdir()` + core$_.bool mkdir() { + return _mkdir(reference.pointer, _id_mkdir.pointer).boolean; + } + + static final _id_mkdirs = File._class.instanceMethodId(r'mkdirs', r'()Z'); + + static final _mkdirs = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean mkdirs()` + core$_.bool mkdirs() { + return _mkdirs(reference.pointer, _id_mkdirs.pointer).boolean; + } + + static final _id_renameTo = File._class.instanceMethodId( + r'renameTo', + r'(Ljava/io/File;)Z', + ); + + static final _renameTo = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `public boolean renameTo(java.io.File file)` + core$_.bool renameTo(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _renameTo( + reference.pointer, + _id_renameTo.pointer, + _$file.pointer, + ).boolean; + } + + static final _id_setExecutable = File._class.instanceMethodId( + r'setExecutable', + r'(Z)Z', + ); + + static final _setExecutable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public boolean setExecutable(boolean z)` + core$_.bool setExecutable(core$_.bool z) { + return _setExecutable( + reference.pointer, + _id_setExecutable.pointer, + z ? 1 : 0, + ).boolean; + } + + static final _id_setExecutable$1 = File._class.instanceMethodId( + r'setExecutable', + r'(ZZ)Z', + ); + + static final _setExecutable$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public boolean setExecutable(boolean z, boolean z1)` + core$_.bool setExecutable$1(core$_.bool z, core$_.bool z1) { + return _setExecutable$1( + reference.pointer, + _id_setExecutable$1.pointer, + z ? 1 : 0, + z1 ? 1 : 0, + ).boolean; + } + + static final _id_setLastModified = File._class.instanceMethodId( + r'setLastModified', + r'(J)Z', + ); + + static final _setLastModified = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int64,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public boolean setLastModified(long j)` + core$_.bool setLastModified(core$_.int j) { + return _setLastModified( + reference.pointer, + _id_setLastModified.pointer, + j, + ).boolean; + } + + static final _id_setReadOnly = File._class.instanceMethodId( + r'setReadOnly', + r'()Z', + ); + + static final _setReadOnly = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public boolean setReadOnly()` + core$_.bool setReadOnly() { + return _setReadOnly(reference.pointer, _id_setReadOnly.pointer).boolean; + } + + static final _id_setReadable = File._class.instanceMethodId( + r'setReadable', + r'(Z)Z', + ); + + static final _setReadable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public boolean setReadable(boolean z)` + core$_.bool setReadable(core$_.bool z) { + return _setReadable( + reference.pointer, + _id_setReadable.pointer, + z ? 1 : 0, + ).boolean; + } + + static final _id_setReadable$1 = File._class.instanceMethodId( + r'setReadable', + r'(ZZ)Z', + ); + + static final _setReadable$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public boolean setReadable(boolean z, boolean z1)` + core$_.bool setReadable$1(core$_.bool z, core$_.bool z1) { + return _setReadable$1( + reference.pointer, + _id_setReadable$1.pointer, + z ? 1 : 0, + z1 ? 1 : 0, + ).boolean; + } + + static final _id_setWritable = File._class.instanceMethodId( + r'setWritable', + r'(Z)Z', + ); + + static final _setWritable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + ) + >(); + + /// from: `public boolean setWritable(boolean z)` + core$_.bool setWritable(core$_.bool z) { + return _setWritable( + reference.pointer, + _id_setWritable.pointer, + z ? 1 : 0, + ).boolean; + } + + static final _id_setWritable$1 = File._class.instanceMethodId( + r'setWritable', + r'(ZZ)Z', + ); + + static final _setWritable$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>, + ) + > + >('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + core$_.int, + core$_.int, + ) + >(); + + /// from: `public boolean setWritable(boolean z, boolean z1)` + core$_.bool setWritable$1(core$_.bool z, core$_.bool z1) { + return _setWritable$1( + reference.pointer, + _id_setWritable$1.pointer, + z ? 1 : 0, + z1 ? 1 : 0, + ).boolean; + } + + static final _id_toPath = File._class.instanceMethodId( + r'toPath', + r'()Ljava/nio/file/Path;', + ); + + static final _toPath = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.nio.file.Path toPath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? toPath() { + return _toPath( + reference.pointer, + _id_toPath.pointer, + ).object(); + } + + static final _id_toString$1 = File._class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? toString$1() { + return _toString$1( + reference.pointer, + _id_toString$1.pointer, + ).object(); + } + + static final _id_toURI = File._class.instanceMethodId( + r'toURI', + r'()Ljava/net/URI;', + ); + + static final _toURI = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.net.URI toURI()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? toURI() { + return _toURI( + reference.pointer, + _id_toURI.pointer, + ).object(); + } + + static final _id_toURL = File._class.instanceMethodId( + r'toURL', + r'()Ljava/net/URL;', + ); + + static final _toURL = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public java.net.URL toURL()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? toURL() { + return _toURL( + reference.pointer, + _id_toURL.pointer, + ).object(); + } + + core$_.bool operator <(File? file) { + return compareTo(file) < 0; + } + + core$_.bool operator <=(File? file) { + return compareTo(file) <= 0; + } + + core$_.bool operator >(File? file) { + return compareTo(file) > 0; + } + + core$_.bool operator >=(File? file) { + return compareTo(file) >= 0; + } +} + +final class $File$Type$ extends jni$_.JType { + @jni$_.internal + const $File$Type$(); + + @jni$_.internal + @core$_.override + String get signature => r'Ljava/io/File;'; +} + +/// from: `android.os.Environment` +extension type Environment._(jni$_.JObject _$this) implements jni$_.JObject { + static final _class = jni$_.JClass.forName(r'android/os/Environment'); + + /// The type which includes information such as the signature of this class. + static const jni$_.JType type = $Environment$Type$(); + static final _id_DIRECTORY_ALARMS = _class.staticFieldId( + r'DIRECTORY_ALARMS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_ALARMS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_ALARMS => + _id_DIRECTORY_ALARMS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_ALARMS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_ALARMS(jni$_.JString? value) => + _id_DIRECTORY_ALARMS.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_AUDIOBOOKS = _class.staticFieldId( + r'DIRECTORY_AUDIOBOOKS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_AUDIOBOOKS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_AUDIOBOOKS => + _id_DIRECTORY_AUDIOBOOKS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_AUDIOBOOKS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_AUDIOBOOKS(jni$_.JString? value) => + _id_DIRECTORY_AUDIOBOOKS.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_DCIM = _class.staticFieldId( + r'DIRECTORY_DCIM', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_DCIM` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_DCIM => + _id_DIRECTORY_DCIM.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_DCIM` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_DCIM(jni$_.JString? value) => + _id_DIRECTORY_DCIM.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_DOCUMENTS = _class.staticFieldId( + r'DIRECTORY_DOCUMENTS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_DOCUMENTS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_DOCUMENTS => + _id_DIRECTORY_DOCUMENTS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_DOCUMENTS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_DOCUMENTS(jni$_.JString? value) => + _id_DIRECTORY_DOCUMENTS.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_DOWNLOADS = _class.staticFieldId( + r'DIRECTORY_DOWNLOADS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_DOWNLOADS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_DOWNLOADS => + _id_DIRECTORY_DOWNLOADS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_DOWNLOADS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_DOWNLOADS(jni$_.JString? value) => + _id_DIRECTORY_DOWNLOADS.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_MOVIES = _class.staticFieldId( + r'DIRECTORY_MOVIES', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_MOVIES` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_MOVIES => + _id_DIRECTORY_MOVIES.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_MOVIES` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_MOVIES(jni$_.JString? value) => + _id_DIRECTORY_MOVIES.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_MUSIC = _class.staticFieldId( + r'DIRECTORY_MUSIC', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_MUSIC` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_MUSIC => + _id_DIRECTORY_MUSIC.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_MUSIC` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_MUSIC(jni$_.JString? value) => + _id_DIRECTORY_MUSIC.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_NOTIFICATIONS = _class.staticFieldId( + r'DIRECTORY_NOTIFICATIONS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_NOTIFICATIONS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_NOTIFICATIONS => + _id_DIRECTORY_NOTIFICATIONS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_NOTIFICATIONS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_NOTIFICATIONS(jni$_.JString? value) => + _id_DIRECTORY_NOTIFICATIONS.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_PICTURES = _class.staticFieldId( + r'DIRECTORY_PICTURES', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_PICTURES` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_PICTURES => + _id_DIRECTORY_PICTURES.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_PICTURES` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_PICTURES(jni$_.JString? value) => + _id_DIRECTORY_PICTURES.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_PODCASTS = _class.staticFieldId( + r'DIRECTORY_PODCASTS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_PODCASTS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_PODCASTS => + _id_DIRECTORY_PODCASTS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_PODCASTS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_PODCASTS(jni$_.JString? value) => + _id_DIRECTORY_PODCASTS.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_RECORDINGS = _class.staticFieldId( + r'DIRECTORY_RECORDINGS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_RECORDINGS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_RECORDINGS => + _id_DIRECTORY_RECORDINGS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_RECORDINGS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_RECORDINGS(jni$_.JString? value) => + _id_DIRECTORY_RECORDINGS.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_RINGTONES = _class.staticFieldId( + r'DIRECTORY_RINGTONES', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_RINGTONES` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_RINGTONES => + _id_DIRECTORY_RINGTONES.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_RINGTONES` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_RINGTONES(jni$_.JString? value) => + _id_DIRECTORY_RINGTONES.set(_class, jni$_.JString.type, value); + + static final _id_DIRECTORY_SCREENSHOTS = _class.staticFieldId( + r'DIRECTORY_SCREENSHOTS', + r'Ljava/lang/String;', + ); + + /// from: `static public java.lang.String DIRECTORY_SCREENSHOTS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get DIRECTORY_SCREENSHOTS => + _id_DIRECTORY_SCREENSHOTS.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + /// from: `static public java.lang.String DIRECTORY_SCREENSHOTS` + /// The returned object must be released after use, by calling the [release] method. + static set DIRECTORY_SCREENSHOTS(jni$_.JString? value) => + _id_DIRECTORY_SCREENSHOTS.set(_class, jni$_.JString.type, value); + + static final _id_MEDIA_BAD_REMOVAL = _class.staticFieldId( + r'MEDIA_BAD_REMOVAL', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_BAD_REMOVAL` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_BAD_REMOVAL => + _id_MEDIA_BAD_REMOVAL.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_CHECKING = _class.staticFieldId( + r'MEDIA_CHECKING', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_CHECKING` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_CHECKING => + _id_MEDIA_CHECKING.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_EJECTING = _class.staticFieldId( + r'MEDIA_EJECTING', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_EJECTING` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_EJECTING => + _id_MEDIA_EJECTING.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_MOUNTED = _class.staticFieldId( + r'MEDIA_MOUNTED', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_MOUNTED` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_MOUNTED => + _id_MEDIA_MOUNTED.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_MOUNTED_READ_ONLY = _class.staticFieldId( + r'MEDIA_MOUNTED_READ_ONLY', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_MOUNTED_READ_ONLY` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_MOUNTED_READ_ONLY => + _id_MEDIA_MOUNTED_READ_ONLY.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_NOFS = _class.staticFieldId( + r'MEDIA_NOFS', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_NOFS` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_NOFS => + _id_MEDIA_NOFS.getNullable(_class, jni$_.JString.type) as jni$_.JString?; + + static final _id_MEDIA_REMOVED = _class.staticFieldId( + r'MEDIA_REMOVED', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_REMOVED` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_REMOVED => + _id_MEDIA_REMOVED.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_SHARED = _class.staticFieldId( + r'MEDIA_SHARED', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_SHARED` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_SHARED => + _id_MEDIA_SHARED.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_UNKNOWN = _class.staticFieldId( + r'MEDIA_UNKNOWN', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_UNKNOWN` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_UNKNOWN => + _id_MEDIA_UNKNOWN.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_UNMOUNTABLE = _class.staticFieldId( + r'MEDIA_UNMOUNTABLE', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_UNMOUNTABLE` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_UNMOUNTABLE => + _id_MEDIA_UNMOUNTABLE.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_MEDIA_UNMOUNTED = _class.staticFieldId( + r'MEDIA_UNMOUNTED', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String MEDIA_UNMOUNTED` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get MEDIA_UNMOUNTED => + _id_MEDIA_UNMOUNTED.getNullable(_class, jni$_.JString.type) + as jni$_.JString?; + + static final _id_new$ = _class.constructorId(r'()V'); + + static final _new$ = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory Environment() { + return _new$( + _class.reference.pointer, + _id_new$.pointer, + ).object(); + } + + static final _id_get$dataDirectory = _class.staticMethodId( + r'getDataDirectory', + r'()Ljava/io/File;', + ); + + static final _get$dataDirectory = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public java.io.File getDataDirectory()` + /// The returned object must be released after use, by calling the [release] method. + static File? get dataDirectory { + return _get$dataDirectory( + _class.reference.pointer, + _id_get$dataDirectory.pointer, + ).object(); + } + + static final _id_get$downloadCacheDirectory = _class.staticMethodId( + r'getDownloadCacheDirectory', + r'()Ljava/io/File;', + ); + + static final _get$downloadCacheDirectory = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public java.io.File getDownloadCacheDirectory()` + /// The returned object must be released after use, by calling the [release] method. + static File? get downloadCacheDirectory { + return _get$downloadCacheDirectory( + _class.reference.pointer, + _id_get$downloadCacheDirectory.pointer, + ).object(); + } + + static final _id_get$externalStorageDirectory = _class.staticMethodId( + r'getExternalStorageDirectory', + r'()Ljava/io/File;', + ); + + static final _get$externalStorageDirectory = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public java.io.File getExternalStorageDirectory()` + /// The returned object must be released after use, by calling the [release] method. + static File? get externalStorageDirectory { + return _get$externalStorageDirectory( + _class.reference.pointer, + _id_get$externalStorageDirectory.pointer, + ).object(); + } + + static final _id_getExternalStoragePublicDirectory = _class.staticMethodId( + r'getExternalStoragePublicDirectory', + r'(Ljava/lang/String;)Ljava/io/File;', + ); + + static final _getExternalStoragePublicDirectory = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `static public java.io.File getExternalStoragePublicDirectory(java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + static File? getExternalStoragePublicDirectory(jni$_.JString? string) { + final _$string = string?.reference ?? jni$_.jNullReference; + return _getExternalStoragePublicDirectory( + _class.reference.pointer, + _id_getExternalStoragePublicDirectory.pointer, + _$string.pointer, + ).object(); + } + + static final _id_get$externalStorageState = _class.staticMethodId( + r'getExternalStorageState', + r'()Ljava/lang/String;', + ); + + static final _get$externalStorageState = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public java.lang.String getExternalStorageState()` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get externalStorageState { + return _get$externalStorageState( + _class.reference.pointer, + _id_get$externalStorageState.pointer, + ).object(); + } + + static final _id_getExternalStorageState = _class.staticMethodId( + r'getExternalStorageState', + r'(Ljava/io/File;)Ljava/lang/String;', + ); + + static final _getExternalStorageState = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `static public java.lang.String getExternalStorageState(java.io.File file)` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? getExternalStorageState(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _getExternalStorageState( + _class.reference.pointer, + _id_getExternalStorageState.pointer, + _$file.pointer, + ).object(); + } + + static final _id_get$rootDirectory = _class.staticMethodId( + r'getRootDirectory', + r'()Ljava/io/File;', + ); + + static final _get$rootDirectory = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public java.io.File getRootDirectory()` + /// The returned object must be released after use, by calling the [release] method. + static File? get rootDirectory { + return _get$rootDirectory( + _class.reference.pointer, + _id_get$rootDirectory.pointer, + ).object(); + } + + static final _id_get$storageDirectory = _class.staticMethodId( + r'getStorageDirectory', + r'()Ljava/io/File;', + ); + + static final _get$storageDirectory = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public java.io.File getStorageDirectory()` + /// The returned object must be released after use, by calling the [release] method. + static File? get storageDirectory { + return _get$storageDirectory( + _class.reference.pointer, + _id_get$storageDirectory.pointer, + ).object(); + } + + static final _id_getStorageState = _class.staticMethodId( + r'getStorageState', + r'(Ljava/io/File;)Ljava/lang/String;', + ); + + static final _getStorageState = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `static public java.lang.String getStorageState(java.io.File file)` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? getStorageState(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _getStorageState( + _class.reference.pointer, + _id_getStorageState.pointer, + _$file.pointer, + ).object(); + } + + static final _id_get$isExternalStorageEmulated = _class.staticMethodId( + r'isExternalStorageEmulated', + r'()Z', + ); + + static final _get$isExternalStorageEmulated = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public boolean isExternalStorageEmulated()` + static core$_.bool get isExternalStorageEmulated { + return _get$isExternalStorageEmulated( + _class.reference.pointer, + _id_get$isExternalStorageEmulated.pointer, + ).boolean; + } + + static final _id_isExternalStorageEmulated$1 = _class.staticMethodId( + r'isExternalStorageEmulated', + r'(Ljava/io/File;)Z', + ); + + static final _isExternalStorageEmulated$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `static public boolean isExternalStorageEmulated(java.io.File file)` + static core$_.bool isExternalStorageEmulated$1(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _isExternalStorageEmulated$1( + _class.reference.pointer, + _id_isExternalStorageEmulated$1.pointer, + _$file.pointer, + ).boolean; + } + + static final _id_get$isExternalStorageLegacy = _class.staticMethodId( + r'isExternalStorageLegacy', + r'()Z', + ); + + static final _get$isExternalStorageLegacy = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public boolean isExternalStorageLegacy()` + static core$_.bool get isExternalStorageLegacy { + return _get$isExternalStorageLegacy( + _class.reference.pointer, + _id_get$isExternalStorageLegacy.pointer, + ).boolean; + } + + static final _id_isExternalStorageLegacy$1 = _class.staticMethodId( + r'isExternalStorageLegacy', + r'(Ljava/io/File;)Z', + ); + + static final _isExternalStorageLegacy$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `static public boolean isExternalStorageLegacy(java.io.File file)` + static core$_.bool isExternalStorageLegacy$1(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _isExternalStorageLegacy$1( + _class.reference.pointer, + _id_isExternalStorageLegacy$1.pointer, + _$file.pointer, + ).boolean; + } + + static final _id_get$isExternalStorageManager = _class.staticMethodId( + r'isExternalStorageManager', + r'()Z', + ); + + static final _get$isExternalStorageManager = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public boolean isExternalStorageManager()` + static core$_.bool get isExternalStorageManager { + return _get$isExternalStorageManager( + _class.reference.pointer, + _id_get$isExternalStorageManager.pointer, + ).boolean; + } + + static final _id_isExternalStorageManager$1 = _class.staticMethodId( + r'isExternalStorageManager', + r'(Ljava/io/File;)Z', + ); + + static final _isExternalStorageManager$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `static public boolean isExternalStorageManager(java.io.File file)` + static core$_.bool isExternalStorageManager$1(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _isExternalStorageManager$1( + _class.reference.pointer, + _id_isExternalStorageManager$1.pointer, + _$file.pointer, + ).boolean; + } + + static final _id_get$isExternalStorageRemovable = _class.staticMethodId( + r'isExternalStorageRemovable', + r'()Z', + ); + + static final _get$isExternalStorageRemovable = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + ) + >(); + + /// from: `static public boolean isExternalStorageRemovable()` + static core$_.bool get isExternalStorageRemovable { + return _get$isExternalStorageRemovable( + _class.reference.pointer, + _id_get$isExternalStorageRemovable.pointer, + ).boolean; + } + + static final _id_isExternalStorageRemovable$1 = _class.staticMethodId( + r'isExternalStorageRemovable', + r'(Ljava/io/File;)Z', + ); + + static final _isExternalStorageRemovable$1 = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>, + ) + > + >('globalEnv_CallStaticBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + ) + >(); + + /// from: `static public boolean isExternalStorageRemovable(java.io.File file)` + static core$_.bool isExternalStorageRemovable$1(File? file) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _isExternalStorageRemovable$1( + _class.reference.pointer, + _id_isExternalStorageRemovable$1.pointer, + _$file.pointer, + ).boolean; + } +} + +final class $Environment$Type$ extends jni$_.JType { + @jni$_.internal + const $Environment$Type$(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroid/os/Environment;'; +} diff --git a/packages/path_provider/path_provider_android/lib/src/path_provider_android_real.dart b/packages/path_provider/path_provider_android/lib/src/path_provider_android_real.dart new file mode 100644 index 000000000000..5430103f8523 --- /dev/null +++ b/packages/path_provider/path_provider_android/lib/src/path_provider_android_real.dart @@ -0,0 +1,152 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:jni/jni.dart'; +import 'package:jni_flutter/jni_flutter.dart'; +import 'package:path_provider_platform_interface/path_provider_platform_interface.dart'; + +import 'path_provider.g.dart'; + +/// The Android implementation of [PathProviderPlatform]. +class PathProviderAndroid extends PathProviderPlatform { + late final Context _applicationContext = androidApplicationContext.as( + Context.type, + ); + + /// Registers this class as the default instance of [PathProviderPlatform]. + static void registerWith() { + PathProviderPlatform.instance = PathProviderAndroid(); + } + + @override + Future getTemporaryPath() { + return getApplicationCachePath(); + } + + @override + Future getApplicationSupportPath() async { + final File? file = _applicationContext.filesDir; + final String? path = file?.path?.toDartString(releaseOriginal: true); + file?.release(); + return path; + } + + @override + Future getApplicationDocumentsPath() async { + final JString directory = 'flutter'.toJString(); + final File? file = _applicationContext.getDir( + directory, + Context.MODE_PRIVATE, + ); + final String? path = file?.path?.toDartString(releaseOriginal: true); + file?.release(); + directory.release(); + return path; + } + + @override + Future getApplicationCachePath() async { + final File? file = _applicationContext.cacheDir; + final String? path = file?.path?.toDartString(releaseOriginal: true); + file?.release(); + return path; + } + + @override + Future getExternalStoragePath() async { + final File? dir = _applicationContext.getExternalFilesDir(null); + if (dir != null) { + final String? path = dir.absolutePath?.toDartString( + releaseOriginal: true, + ); + dir.release(); + return path; + } + + return null; + } + + @override + Future?> getExternalCachePaths() async { + final JArray? files = _applicationContext.externalCacheDirs; + if (files != null) { + final List paths = _toStringList(files); + files.release(); + return paths; + } + + return null; + } + + @override + Future?> getExternalStoragePaths({ + StorageDirectory? type, + }) async { + final JString? directory = type != null + ? _toNativeStorageDirectory(type) + : null; + final JArray? files = _applicationContext.getExternalFilesDirs( + directory, + ); + directory?.release(); + if (files != null) { + final List paths = _toStringList(files); + files.release(); + return paths; + } + + return null; + } + + @override + Future getDownloadsPath() async { + final List? paths = await getExternalStoragePaths( + type: StorageDirectory.downloads, + ); + return paths?.firstOrNull; + } +} + +JString _toNativeStorageDirectory(StorageDirectory directory) { + switch (directory) { + case StorageDirectory.music: + return Environment.DIRECTORY_MUSIC!; + case StorageDirectory.podcasts: + return Environment.DIRECTORY_PODCASTS!; + case StorageDirectory.ringtones: + return Environment.DIRECTORY_RINGTONES!; + case StorageDirectory.alarms: + return Environment.DIRECTORY_ALARMS!; + case StorageDirectory.notifications: + return Environment.DIRECTORY_NOTIFICATIONS!; + case StorageDirectory.pictures: + return Environment.DIRECTORY_PICTURES!; + case StorageDirectory.movies: + return Environment.DIRECTORY_MOVIES!; + case StorageDirectory.downloads: + return Environment.DIRECTORY_DOWNLOADS!; + case StorageDirectory.dcim: + return Environment.DIRECTORY_DCIM!; + case StorageDirectory.documents: + return Environment.DIRECTORY_DOCUMENTS!; + } +} + +List _toStringList(JArray files) { + final List dartList = files.asDart(); + final paths = []; + for (final file in dartList) { + if (file != null) { + final String? path = file.absolutePath?.toDartString( + releaseOriginal: true, + ); + if (path != null) { + paths.add(path); + } + file.release(); + } + } + + return paths; +} diff --git a/packages/path_provider/path_provider_android/lib/src/path_provider_android_stub.dart b/packages/path_provider/path_provider_android/lib/src/path_provider_android_stub.dart new file mode 100644 index 000000000000..5e24c93a8ffd --- /dev/null +++ b/packages/path_provider/path_provider_android/lib/src/path_provider_android_stub.dart @@ -0,0 +1,15 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:path_provider_platform_interface/path_provider_platform_interface.dart'; + +// This file is a stub to satisfy the analyzer by matching the public API +// surface of the real implementation. This code should never actually be +// called. + +/// The Android implementation of [PathProviderPlatform]. +class PathProviderAndroid extends PathProviderPlatform { + /// Registers this class as the default instance of [PathProviderPlatform]. + static void registerWith() {} +} diff --git a/packages/path_provider/path_provider_android/pigeons/copyright.txt b/packages/path_provider/path_provider_android/pigeons/copyright.txt deleted file mode 100644 index 07e5f8598a80..000000000000 --- a/packages/path_provider/path_provider_android/pigeons/copyright.txt +++ /dev/null @@ -1,3 +0,0 @@ -Copyright 2013 The Flutter Authors -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. diff --git a/packages/path_provider/path_provider_android/pigeons/messages.dart b/packages/path_provider/path_provider_android/pigeons/messages.dart deleted file mode 100644 index 848018cedd1c..000000000000 --- a/packages/path_provider/path_provider_android/pigeons/messages.dart +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -import 'package:pigeon/pigeon.dart'; - -@ConfigurePigeon( - PigeonOptions( - input: 'pigeons/messages.dart', - javaOut: - 'android/src/main/java/io/flutter/plugins/pathprovider/Messages.java', - javaOptions: JavaOptions( - className: 'Messages', - package: 'io.flutter.plugins.pathprovider', - ), - dartOut: 'lib/messages.g.dart', - copyrightHeader: 'pigeons/copyright.txt', - ), -) -enum StorageDirectory { - root, - music, - podcasts, - ringtones, - alarms, - notifications, - pictures, - movies, - downloads, - dcim, - documents, -} - -@HostApi() -abstract class PathProviderApi { - @TaskQueue(type: TaskQueueType.serialBackgroundThread) - String? getTemporaryPath(); - @TaskQueue(type: TaskQueueType.serialBackgroundThread) - String? getApplicationSupportPath(); - @TaskQueue(type: TaskQueueType.serialBackgroundThread) - String? getApplicationDocumentsPath(); - @TaskQueue(type: TaskQueueType.serialBackgroundThread) - String? getApplicationCachePath(); - @TaskQueue(type: TaskQueueType.serialBackgroundThread) - String? getExternalStoragePath(); - @TaskQueue(type: TaskQueueType.serialBackgroundThread) - List getExternalCachePaths(); - @TaskQueue(type: TaskQueueType.serialBackgroundThread) - List getExternalStoragePaths(StorageDirectory directory); -} diff --git a/packages/path_provider/path_provider_android/pubspec.yaml b/packages/path_provider/path_provider_android/pubspec.yaml index a5a6380aa24b..5f0ecc512275 100644 --- a/packages/path_provider/path_provider_android/pubspec.yaml +++ b/packages/path_provider/path_provider_android/pubspec.yaml @@ -2,7 +2,7 @@ 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.23 +version: 2.3.1 environment: sdk: ^3.9.0 @@ -13,19 +13,19 @@ flutter: implements: path_provider platforms: android: - package: io.flutter.plugins.pathprovider - pluginClass: PathProviderPlugin dartPluginClass: PathProviderAndroid dependencies: flutter: sdk: flutter + jni: ^1.0.0 + jni_flutter: ^1.0.1 path_provider_platform_interface: ^2.1.0 dev_dependencies: flutter_test: sdk: flutter - pigeon: ^26.1.0 + jnigen: ^0.16.0 test: ^1.16.0 topics: diff --git a/packages/path_provider/path_provider_android/test/path_provider_android_test.dart b/packages/path_provider/path_provider_android/test/path_provider_android_test.dart index 7b1f2d5d94ec..49763a37397f 100644 --- a/packages/path_provider/path_provider_android/test/path_provider_android_test.dart +++ b/packages/path_provider/path_provider_android/test/path_provider_android_test.dart @@ -2,127 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:flutter/src/services/binary_messenger.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:path_provider_android/messages.g.dart' as messages; import 'package:path_provider_android/path_provider_android.dart'; import 'package:path_provider_platform_interface/path_provider_platform_interface.dart'; -const String kTemporaryPath = 'temporaryPath'; -const String kApplicationSupportPath = 'applicationSupportPath'; -const String kApplicationDocumentsPath = 'applicationDocumentsPath'; -const String kApplicationCachePath = 'applicationCachePath'; -const String kExternalCachePaths = 'externalCachePaths'; -const String kExternalStoragePaths = 'externalStoragePaths'; - -class _Api implements messages.PathProviderApi { - bool returnsExternalStoragePaths = true; - - @override - Future getApplicationDocumentsPath() async => - kApplicationDocumentsPath; - - @override - Future getApplicationSupportPath() async => kApplicationSupportPath; - - @override - Future getApplicationCachePath() async => kApplicationCachePath; - - @override - Future> getExternalCachePaths() async => [ - kExternalCachePaths, - ]; - - @override - Future getExternalStoragePath() async => kExternalStoragePaths; - - @override - Future> getExternalStoragePaths( - messages.StorageDirectory directory, - ) async { - return [if (returnsExternalStoragePaths) kExternalStoragePaths]; - } - - @override - Future getTemporaryPath() async => kTemporaryPath; - - @override - // ignore: non_constant_identifier_names - BinaryMessenger? get pigeonVar_binaryMessenger => null; - - @override - // ignore: non_constant_identifier_names - String get pigeonVar_messageChannelSuffix => ''; -} +// Most tests are in integration_test rather than here, because anything that +// needs to create Java objects has to run in the real runtime. void main() { - late _Api api; - - group('PathProviderAndroid', () { - late PathProviderAndroid pathProvider; - - setUp(() async { - api = _Api(); - pathProvider = PathProviderAndroid(api: api); - }); - - test('getTemporaryPath', () async { - final String? path = await pathProvider.getTemporaryPath(); - expect(path, kTemporaryPath); - }); - - test('getApplicationSupportPath', () async { - final String? path = await pathProvider.getApplicationSupportPath(); - expect(path, kApplicationSupportPath); - }); - - test('getApplicationCachePath', () async { - final String? path = await pathProvider.getApplicationCachePath(); - expect(path, kApplicationCachePath); - }); - - test('getLibraryPath fails', () async { - try { - await pathProvider.getLibraryPath(); - fail('should throw UnsupportedError'); - } catch (e) { - expect(e, isUnsupportedError); - } - }); - - test('getApplicationDocumentsPath', () async { - final String? path = await pathProvider.getApplicationDocumentsPath(); - expect(path, kApplicationDocumentsPath); - }); - - test('getExternalCachePaths succeeds', () async { - final List? result = await pathProvider.getExternalCachePaths(); - expect(result!.length, 1); - expect(result.first, kExternalCachePaths); - }); - - for (final StorageDirectory? type in [ - ...StorageDirectory.values, - ]) { - test('getExternalStoragePaths (type: $type) android succeeds', () async { - final List? result = await pathProvider.getExternalStoragePaths( - type: type, - ); - expect(result!.length, 1); - expect(result.first, kExternalStoragePaths); - }); - } // end of for-loop - - test('getDownloadsPath succeeds', () async { - final String? path = await pathProvider.getDownloadsPath(); - expect(path, kExternalStoragePaths); - }); - - test('getDownloadsPath returns null, when getExternalStoragePaths returns ' - 'an empty list', () async { - api.returnsExternalStoragePaths = false; - final String? path = await pathProvider.getDownloadsPath(); - expect(path, null); - }); + test('registers instance', () { + PathProviderAndroid.registerWith(); + expect(PathProviderPlatform.instance, isA()); }); } diff --git a/packages/path_provider/path_provider_android/tool/jnigen.dart b/packages/path_provider/path_provider_android/tool/jnigen.dart new file mode 100644 index 000000000000..9a626afe1cc0 --- /dev/null +++ b/packages/path_provider/path_provider_android/tool/jnigen.dart @@ -0,0 +1,30 @@ +// Copyright 2013 The Flutter Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:io'; + +import 'package:jnigen/jnigen.dart'; + +void main() { + final Uri packageRoot = Platform.script.resolve('../'); + generateJniBindings( + Config( + outputConfig: OutputConfig( + dartConfig: DartCodeOutputConfig( + path: packageRoot.resolve('lib/src/path_provider.g.dart'), + structure: OutputStructure.singleFile, + ), + ), + androidSdkConfig: AndroidSdkConfig( + addGradleDeps: true, + androidExample: 'example/', + ), + classes: [ + 'android.content.Context', + 'java.io.File', + 'android.os.Environment', + ], + ), + ); +} diff --git a/packages/path_provider/path_provider_linux/example/linux/flutter/generated_plugins.cmake b/packages/path_provider/path_provider_linux/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/path_provider/path_provider_linux/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake b/packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index 368abc59a80f..1d8884d3e71c 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,8 @@ +## 26.3.4 + +* [kotlin] Updates generated error class to inherit from `RuntimeException` + instead of `Throwable`, for better Java interoperability. + ## 26.3.3 * Updates `analyzer` dependency to support versions 10 through 12. diff --git a/packages/pigeon/example/app/android/app/build.gradle b/packages/pigeon/example/app/android/app/build.gradle deleted file mode 100644 index f1eadc2f3cfc..000000000000 --- a/packages/pigeon/example/app/android/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "dev.flutter.pigeon_example_app" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "dev.flutter.pigeon_example_app" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} diff --git a/packages/pigeon/example/app/android/app/build.gradle.kts b/packages/pigeon/example/app/android/app/build.gradle.kts new file mode 100644 index 000000000000..2b5f00fb72c5 --- /dev/null +++ b/packages/pigeon/example/app/android/app/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "dev.flutter.pigeon_example_app" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "dev.flutter.pigeon_example_app" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt index f82200d46f0d..9557d8c13297 100644 --- a/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt +++ b/packages/pigeon/example/app/android/app/src/main/kotlin/dev/flutter/pigeon_example_app/Messages.g.kt @@ -191,7 +191,7 @@ class FlutterError( val code: String, override val message: String? = null, val details: Any? = null -) : Throwable() +) : RuntimeException() enum class Code(val raw: Int) { ONE(0), diff --git a/packages/pigeon/example/app/android/build.gradle b/packages/pigeon/example/app/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/pigeon/example/app/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/pigeon/example/app/android/build.gradle.kts b/packages/pigeon/example/app/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/pigeon/example/app/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/pigeon/example/app/android/settings.gradle b/packages/pigeon/example/app/android/settings.gradle deleted file mode 100644 index b9ca9c0ead08..000000000000 --- a/packages/pigeon/example/app/android/settings.gradle +++ /dev/null @@ -1,28 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" - -} - -include ":app" diff --git a/packages/pigeon/example/app/android/settings.gradle.kts b/packages/pigeon/example/app/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/pigeon/example/app/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/pigeon/example/app/linux/flutter/generated_plugins.cmake b/packages/pigeon/example/app/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/pigeon/example/app/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/pigeon/example/app/windows/flutter/generated_plugins.cmake b/packages/pigeon/example/app/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/pigeon/example/app/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/pigeon/lib/src/generator_tools.dart b/packages/pigeon/lib/src/generator_tools.dart index 604691d46d3e..55874a95684a 100644 --- a/packages/pigeon/lib/src/generator_tools.dart +++ b/packages/pigeon/lib/src/generator_tools.dart @@ -15,7 +15,7 @@ import 'generator.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '26.3.3'; +const String pigeonVersion = '26.3.4'; /// Default plugin package name. const String defaultPluginPackageName = 'dev.flutter.pigeon'; diff --git a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart index fee33c6b66d6..41e6a880f0a2 100644 --- a/packages/pigeon/lib/src/kotlin/kotlin_generator.dart +++ b/packages/pigeon/lib/src/kotlin/kotlin_generator.dart @@ -1350,7 +1350,7 @@ if (wrapped == null) { indent.writeln('override val message: String? = null,'); indent.writeln('val details: Any? = null'); }, addTrailingNewline: false); - indent.addln(' : Throwable()'); + indent.addln(' : RuntimeException()'); } void _writeCreateConnectionError( diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle deleted file mode 100644 index afae2c9e3b77..000000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "com.example.alternate_language_test_plugin_example" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.alternate_language_test_plugin_example" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle.kts b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..422bfc7419eb --- /dev/null +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/app/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.example.alternate_language_test_plugin_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "com.example.alternate_language_test_plugin_example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle deleted file mode 100644 index 3f78da216a0e..000000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -gradle.projectsEvaluated { - project(":alternate_language_test_plugin") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle.kts b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle.kts new file mode 100644 index 000000000000..31a165502a58 --- /dev/null +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/build.gradle.kts @@ -0,0 +1,42 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} + +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +gradle.projectsEvaluated { + project(":alternate_language_test_plugin") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle deleted file mode 100644 index b83203f03197..000000000000 --- a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle.kts b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/pigeon/platform_tests/alternate_language_test_plugin/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt index 338a53b8e3b3..938204b49782 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/CoreTests.gen.kt @@ -194,7 +194,7 @@ class FlutterError( val code: String, override val message: String? = null, val details: Any? = null -) : Throwable() +) : RuntimeException() enum class AnEnum(val raw: Int) { ONE(0), diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt index b98e54fef79c..9e55d6984836 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/EventChannelTests.gen.kt @@ -172,7 +172,7 @@ class EventChannelTestsError( val code: String, override val message: String? = null, val details: Any? = null -) : Throwable() +) : RuntimeException() enum class EventEnum(val raw: Int) { ONE(0), diff --git a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt index ab979311a10c..27ced4fade57 100644 --- a/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt +++ b/packages/pigeon/platform_tests/test_plugin/android/src/main/kotlin/com/example/test_plugin/ProxyApiTests.gen.kt @@ -50,7 +50,7 @@ class ProxyApiTestsError( val code: String, override val message: String? = null, val details: Any? = null -) : Throwable() +) : RuntimeException() /** * Maintains instances used to communicate with the corresponding objects in Dart. * diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle b/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle deleted file mode 100644 index 551d7ce3a9b7..000000000000 --- a/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "com.example.test_plugin_example" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - - lint { - baseline = file("lint-baseline.xml") - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.test_plugin_example" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle.kts b/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..a5f1632dd97b --- /dev/null +++ b/packages/pigeon/platform_tests/test_plugin/example/android/app/build.gradle.kts @@ -0,0 +1,42 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.example.test_plugin_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + lint { + baseline = file("lint-baseline.xml") + } + + defaultConfig { + applicationId = "com.example.test_plugin_example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle b/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle deleted file mode 100644 index aa651bee379b..000000000000 --- a/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -gradle.projectsEvaluated { - project(":test_plugin") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle.kts b/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle.kts new file mode 100644 index 000000000000..a52cb115b20d --- /dev/null +++ b/packages/pigeon/platform_tests/test_plugin/example/android/build.gradle.kts @@ -0,0 +1,42 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} + +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +gradle.projectsEvaluated { + project(":test_plugin") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle b/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle deleted file mode 100644 index b83203f03197..000000000000 --- a/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle.kts b/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/pigeon/platform_tests/test_plugin/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/pigeon/platform_tests/test_plugin/example/linux/flutter/generated_plugins.cmake b/packages/pigeon/platform_tests/test_plugin/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 98e2c9fa93fd..000000000000 --- a/packages/pigeon/platform_tests/test_plugin/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - test_plugin -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/pigeon/platform_tests/test_plugin/example/windows/flutter/generated_plugins.cmake b/packages/pigeon/platform_tests/test_plugin/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 8b8b5042fbb3..000000000000 --- a/packages/pigeon/platform_tests/test_plugin/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - test_plugin -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 637fb3f6fe6b..804181258e69 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -2,7 +2,7 @@ name: pigeon description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. repository: https://github.com/flutter/packages/tree/main/packages/pigeon issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22 -version: 26.3.3 # This must match the version in lib/src/generator_tools.dart +version: 26.3.4 # This must match the version in lib/src/generator_tools.dart environment: sdk: ^3.9.0 @@ -27,4 +27,3 @@ topics: - interop - platform-channels - plugin-development - diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart index 479357d57fe3..fe9600e81bc1 100644 --- a/packages/pigeon/test/kotlin_generator_test.dart +++ b/packages/pigeon/test/kotlin_generator_test.dart @@ -1983,6 +1983,45 @@ void main() { expect(code, isNot(contains('FlutterError'))); }); + test('error class inherits from RuntimeException', () { + final root = Root( + apis: [ + AstHostApi( + name: 'Api', + methods: [ + Method( + name: 'method', + location: ApiLocation.host, + returnType: const TypeDeclaration.voidDeclaration(), + parameters: [ + Parameter( + name: 'field', + type: const TypeDeclaration( + baseName: 'int', + isNullable: true, + ), + ), + ], + ), + ], + ), + ], + classes: [], + enums: [], + ); + final sink = StringBuffer(); + const kotlinOptions = InternalKotlinOptions(kotlinOut: ''); + const generator = KotlinGenerator(); + generator.generate( + kotlinOptions, + root, + sink, + dartPackageName: DEFAULT_PACKAGE_NAME, + ); + final code = sink.toString(); + expect(code, contains(': RuntimeException()')); + }); + test('do not generate duplicated entries in writeValue', () { final root = Root( apis: [ diff --git a/packages/quick_actions/quick_actions/example/android/app/build.gradle b/packages/quick_actions/quick_actions/example/android/app/build.gradle deleted file mode 100644 index 3b940b20c577..000000000000 --- a/packages/quick_actions/quick_actions/example/android/app/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.quickactionsexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.quickactionsexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/quick_actions/quick_actions/example/android/app/build.gradle.kts b/packages/quick_actions/quick_actions/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..f677fe3f420a --- /dev/null +++ b/packages/quick_actions/quick_actions/example/android/app/build.gradle.kts @@ -0,0 +1,48 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.quickactionsexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.quickactionsexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/quick_actions/quick_actions/example/android/build.gradle b/packages/quick_actions/quick_actions/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/quick_actions/quick_actions/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/quick_actions/quick_actions/example/android/build.gradle.kts b/packages/quick_actions/quick_actions/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/quick_actions/quick_actions/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/quick_actions/quick_actions/example/android/settings.gradle b/packages/quick_actions/quick_actions/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/quick_actions/quick_actions/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/quick_actions/quick_actions/example/android/settings.gradle.kts b/packages/quick_actions/quick_actions/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/quick_actions/quick_actions/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/quick_actions/quick_actions_android/example/android/app/build.gradle b/packages/quick_actions/quick_actions_android/example/android/app/build.gradle deleted file mode 100644 index c054bb603344..000000000000 --- a/packages/quick_actions/quick_actions_android/example/android/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -def androidXTestVersion = '1.4.0' - -android { - namespace = "io.flutter.plugins.quickactionsexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.quickactionsexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:$androidXTestVersion") - - androidTestImplementation("androidx.test:runner:$androidXTestVersion") - androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0") - androidTestImplementation("androidx.test.ext:junit:1.0.0") - androidTestImplementation("org.mockito:mockito-core:5.0.0") - androidTestImplementation("org.mockito:mockito-android:5.0.0") -} diff --git a/packages/quick_actions/quick_actions_android/example/android/app/build.gradle.kts b/packages/quick_actions/quick_actions_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..946557001ac0 --- /dev/null +++ b/packages/quick_actions/quick_actions_android/example/android/app/build.gradle.kts @@ -0,0 +1,54 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.quickactionsexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.quickactionsexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +val androidXTestVersion = "1.4.0" + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:$androidXTestVersion") + androidTestImplementation("androidx.test:runner:$androidXTestVersion") + androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0") + androidTestImplementation("androidx.test.ext:junit:1.0.0") + androidTestImplementation("org.mockito:mockito-core:5.0.0") + androidTestImplementation("org.mockito:mockito-android:5.0.0") +} diff --git a/packages/quick_actions/quick_actions_android/example/android/build.gradle b/packages/quick_actions/quick_actions_android/example/android/build.gradle deleted file mode 100644 index 44c90020bf66..000000000000 --- a/packages/quick_actions/quick_actions_android/example/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":quick_actions_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/quick_actions/quick_actions_android/example/android/build.gradle.kts b/packages/quick_actions/quick_actions_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..22099c5a32ab --- /dev/null +++ b/packages/quick_actions/quick_actions_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":quick_actions_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/quick_actions/quick_actions_android/example/android/settings.gradle b/packages/quick_actions/quick_actions_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/quick_actions/quick_actions_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/quick_actions/quick_actions_android/example/android/settings.gradle.kts b/packages/quick_actions/quick_actions_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/quick_actions/quick_actions_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/rfw/example/hello/linux/flutter/generated_plugins.cmake b/packages/rfw/example/hello/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/rfw/example/hello/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/rfw/example/hello/windows/flutter/generated_plugins.cmake b/packages/rfw/example/hello/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/rfw/example/hello/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/rfw/example/local/linux/flutter/generated_plugins.cmake b/packages/rfw/example/local/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/rfw/example/local/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/rfw/example/local/windows/flutter/generated_plugins.cmake b/packages/rfw/example/local/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/rfw/example/local/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/rfw/example/remote/linux/flutter/generated_plugins.cmake b/packages/rfw/example/remote/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/rfw/example/remote/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/rfw/example/remote/windows/flutter/generated_plugins.cmake b/packages/rfw/example/remote/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/rfw/example/remote/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/shared_preferences/shared_preferences/example/android/app/build.gradle b/packages/shared_preferences/shared_preferences/example/android/app/build.gradle deleted file mode 100644 index 2e7513c07d31..000000000000 --- a/packages/shared_preferences/shared_preferences/example/android/app/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.sharedpreferencesexample" - compileSdk = flutter.compileSdkVersion - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - - defaultConfig { - applicationId "io.flutter.plugins.sharedpreferencesexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} diff --git a/packages/shared_preferences/shared_preferences/example/android/app/build.gradle.kts b/packages/shared_preferences/shared_preferences/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..bc121b47fccf --- /dev/null +++ b/packages/shared_preferences/shared_preferences/example/android/app/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.sharedpreferencesexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.sharedpreferencesexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/packages/shared_preferences/shared_preferences/example/android/build.gradle b/packages/shared_preferences/shared_preferences/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/shared_preferences/shared_preferences/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/shared_preferences/shared_preferences/example/android/build.gradle.kts b/packages/shared_preferences/shared_preferences/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/shared_preferences/shared_preferences/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/shared_preferences/shared_preferences/example/android/settings.gradle b/packages/shared_preferences/shared_preferences/example/android/settings.gradle deleted file mode 100644 index b83203f03197..000000000000 --- a/packages/shared_preferences/shared_preferences/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/shared_preferences/shared_preferences/example/android/settings.gradle.kts b/packages/shared_preferences/shared_preferences/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/shared_preferences/shared_preferences/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/shared_preferences/shared_preferences/example/linux/flutter/generated_plugins.cmake b/packages/shared_preferences/shared_preferences/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/shared_preferences/shared_preferences/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/shared_preferences/shared_preferences/example/windows/flutter/generated_plugins.cmake b/packages/shared_preferences/shared_preferences/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/shared_preferences/shared_preferences/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle b/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle deleted file mode 100644 index 90566aab6169..000000000000 --- a/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle +++ /dev/null @@ -1,87 +0,0 @@ -buildscript { - ext.kotlin_version = '2.1.0' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:9.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "dev.flutter.plugins.shared_preferences_example" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - applicationId "dev.flutter.plugins.shared_preferences_example" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } -} - -flutter { - source = '../..' -} - -dependencies { - implementation("androidx.datastore:datastore-preferences:1.0.0") - implementation("androidx.preference:preference:1.2.1") - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.espresso:espresso-intents:3.2.0") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test:rules:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle.kts b/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..42f5ba3743f0 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_android/example/android/app/build.gradle.kts @@ -0,0 +1,53 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "dev.flutter.plugins.shared_preferences_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "dev.flutter.plugins.shared_preferences_example" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + implementation("androidx.datastore:datastore-preferences:1.0.0") + implementation("androidx.preference:preference:1.2.1") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.espresso:espresso-intents:3.2.0") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test:rules:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/shared_preferences/shared_preferences_android/example/android/build.gradle b/packages/shared_preferences/shared_preferences_android/example/android/build.gradle deleted file mode 100644 index 5717c2b2377b..000000000000 --- a/packages/shared_preferences/shared_preferences_android/example/android/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":shared_preferences_android") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/shared_preferences/shared_preferences_android/example/android/build.gradle.kts b/packages/shared_preferences/shared_preferences_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..397631cd0643 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":shared_preferences_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle b/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle deleted file mode 100644 index b83203f03197..000000000000 --- a/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle.kts b/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/shared_preferences/shared_preferences_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/shared_preferences/shared_preferences_linux/example/linux/flutter/generated_plugins.cmake b/packages/shared_preferences/shared_preferences_linux/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/shared_preferences/shared_preferences_linux/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/shared_preferences/shared_preferences_windows/example/windows/flutter/generated_plugins.cmake b/packages/shared_preferences/shared_preferences_windows/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/shared_preferences/shared_preferences_windows/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/two_dimensional_scrollables/example/linux/flutter/generated_plugins.cmake b/packages/two_dimensional_scrollables/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/two_dimensional_scrollables/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/two_dimensional_scrollables/example/windows/flutter/generated_plugins.cmake b/packages/two_dimensional_scrollables/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/packages/two_dimensional_scrollables/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/url_launcher/url_launcher/example/android/app/build.gradle b/packages/url_launcher/url_launcher/example/android/app/build.gradle deleted file mode 100644 index a61e85e82b21..000000000000 --- a/packages/url_launcher/url_launcher/example/android/app/build.gradle +++ /dev/null @@ -1,59 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.urllauncherexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.urllauncherexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") -} diff --git a/packages/url_launcher/url_launcher/example/android/app/build.gradle.kts b/packages/url_launcher/url_launcher/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..402d90a1fd67 --- /dev/null +++ b/packages/url_launcher/url_launcher/example/android/app/build.gradle.kts @@ -0,0 +1,47 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.urllauncherexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.urllauncherexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") +} diff --git a/packages/url_launcher/url_launcher/example/android/build.gradle b/packages/url_launcher/url_launcher/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/url_launcher/url_launcher/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/url_launcher/url_launcher/example/android/build.gradle.kts b/packages/url_launcher/url_launcher/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/url_launcher/url_launcher/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/url_launcher/url_launcher/example/android/settings.gradle b/packages/url_launcher/url_launcher/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/url_launcher/url_launcher/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/url_launcher/url_launcher/example/android/settings.gradle.kts b/packages/url_launcher/url_launcher/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/url_launcher/url_launcher/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/url_launcher/url_launcher/example/linux/flutter/generated_plugins.cmake b/packages/url_launcher/url_launcher/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index f16b4c34213a..000000000000 --- a/packages/url_launcher/url_launcher/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - url_launcher_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/url_launcher/url_launcher/example/windows/flutter/generated_plugins.cmake b/packages/url_launcher/url_launcher/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 88b22e5c775e..000000000000 --- a/packages/url_launcher/url_launcher/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - url_launcher_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/url_launcher/url_launcher_android/example/android/app/build.gradle b/packages/url_launcher/url_launcher_android/example/android/app/build.gradle deleted file mode 100644 index a61e85e82b21..000000000000 --- a/packages/url_launcher/url_launcher_android/example/android/app/build.gradle +++ /dev/null @@ -1,59 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.urllauncherexample" - compileSdk = flutter.compileSdkVersion - - - defaultConfig { - applicationId "io.flutter.plugins.urllauncherexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") -} diff --git a/packages/url_launcher/url_launcher_android/example/android/app/build.gradle.kts b/packages/url_launcher/url_launcher_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..402d90a1fd67 --- /dev/null +++ b/packages/url_launcher/url_launcher_android/example/android/app/build.gradle.kts @@ -0,0 +1,47 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.urllauncherexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.urllauncherexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") +} diff --git a/packages/url_launcher/url_launcher_android/example/android/build.gradle b/packages/url_launcher/url_launcher_android/example/android/build.gradle deleted file mode 100644 index 1f684e949855..000000000000 --- a/packages/url_launcher/url_launcher_android/example/android/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":url_launcher_android") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - } - } -} diff --git a/packages/url_launcher/url_launcher_android/example/android/build.gradle.kts b/packages/url_launcher/url_launcher_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..bfa5b5c8064b --- /dev/null +++ b/packages/url_launcher/url_launcher_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":url_launcher_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/url_launcher/url_launcher_android/example/android/settings.gradle b/packages/url_launcher/url_launcher_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/url_launcher/url_launcher_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/url_launcher/url_launcher_android/example/android/settings.gradle.kts b/packages/url_launcher/url_launcher_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/url_launcher/url_launcher_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/url_launcher/url_launcher_linux/example/linux/flutter/generated_plugins.cmake b/packages/url_launcher/url_launcher_linux/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index f16b4c34213a..000000000000 --- a/packages/url_launcher/url_launcher_linux/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - url_launcher_linux -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/url_launcher/url_launcher_windows/example/windows/flutter/generated_plugins.cmake b/packages/url_launcher/url_launcher_windows/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index 88b22e5c775e..000000000000 --- a/packages/url_launcher/url_launcher_windows/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - url_launcher_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/packages/video_player/video_player/example/android/app/build.gradle b/packages/video_player/video_player/example/android/app/build.gradle deleted file mode 100644 index 5a8787bcc93a..000000000000 --- a/packages/video_player/video_player/example/android/app/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.videoplayerexample" - compileSdk = flutter.compileSdkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - defaultConfig { - applicationId "io.flutter.plugins.videoplayerexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - testImplementation("org.robolectric:robolectric:4.16") - testImplementation("org.mockito:mockito-core:5.0.0") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") -} diff --git a/packages/video_player/video_player/example/android/app/build.gradle.kts b/packages/video_player/video_player/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..01996cc0ae47 --- /dev/null +++ b/packages/video_player/video_player/example/android/app/build.gradle.kts @@ -0,0 +1,49 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.videoplayerexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.videoplayerexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + testImplementation("org.robolectric:robolectric:4.16") + testImplementation("org.mockito:mockito-core:5.0.0") + androidTestImplementation("androidx.test:runner:1.1.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") +} diff --git a/packages/video_player/video_player/example/android/build.gradle b/packages/video_player/video_player/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/video_player/video_player/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/video_player/video_player/example/android/build.gradle.kts b/packages/video_player/video_player/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/video_player/video_player/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/video_player/video_player/example/android/settings.gradle b/packages/video_player/video_player/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/video_player/video_player/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/video_player/video_player/example/android/settings.gradle.kts b/packages/video_player/video_player/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/video_player/video_player/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/video_player/video_player_android/example/android/app/build.gradle b/packages/video_player/video_player_android/example/android/app/build.gradle deleted file mode 100644 index ad24641085da..000000000000 --- a/packages/video_player/video_player_android/example/android/app/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.videoplayerexample" - compileSdk = flutter.compileSdkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - defaultConfig { - applicationId "io.flutter.plugins.videoplayerexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("androidx.test.ext:junit:1.2.1") - testImplementation("com.google.truth:truth:1.1.3") - testImplementation("junit:junit:4.13") - testImplementation("org.robolectric:robolectric:4.16") - testImplementation("org.mockito:mockito-core:5.17.0") - androidTestImplementation("androidx.test:runner:1.1.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") - implementation(project(':espresso')) - api("androidx.test:core:1.2.0") -} diff --git a/packages/video_player/video_player_android/example/android/app/build.gradle.kts b/packages/video_player/video_player_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..5b4a09a7cd4e --- /dev/null +++ b/packages/video_player/video_player_android/example/android/app/build.gradle.kts @@ -0,0 +1,53 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.videoplayerexample" + compileSdk = flutter.compileSdkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.videoplayerexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("androidx.test.ext:junit:1.2.1") + testImplementation("com.google.truth:truth:1.1.3") + testImplementation("junit:junit:4.13") + testImplementation("org.robolectric:robolectric:4.16") + testImplementation("org.mockito:mockito-core:5.17.0") + androidTestImplementation("androidx.test:runner:1.1.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1") + implementation(project(":espresso")) + api("androidx.test:core:1.2.0") +} diff --git a/packages/video_player/video_player_android/example/android/build.gradle b/packages/video_player/video_player_android/example/android/build.gradle deleted file mode 100644 index f380df723f2d..000000000000 --- a/packages/video_player/video_player_android/example/android/build.gradle +++ /dev/null @@ -1,59 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":video_player_android") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" - - // Workaround for several warnings when building - // that the above turns into errors, coming from - // org.checkerframework.checker.nullness.qual and - // com.google.errorprone.annotations: - // - // warning: Cannot find annotation method 'value()' in type - // 'EnsuresNonNull': class file for - // org.checkerframework.checker.nullness.qual.EnsuresNonNull not found - // - // warning: Cannot find annotation method 'replacement()' in type - // 'InlineMe': class file for - // com.google.errorprone.annotations.InlineMe not found - // - // The dependency version are taken from: - // https://github.com/google/ExoPlayer/blob/r2.18.1/constants.gradle - // - // For future reference the dependencies are excluded here: - // https://github.com/google/ExoPlayer/blob/r2.18.1/library/common/build.gradle#L33-L34 - dependencies { - implementation("org.checkerframework:checker-qual:3.13.0") - implementation("com.google.errorprone:error_prone_annotations:2.10.0") - } - } - } -} diff --git a/packages/video_player/video_player_android/example/android/build.gradle.kts b/packages/video_player/video_player_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..dd31c341ea05 --- /dev/null +++ b/packages/video_player/video_player_android/example/android/build.gradle.kts @@ -0,0 +1,67 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":video_player_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + // Workaround for several warnings when building + // that the above turns into errors, coming from + // org.checkerframework.checker.nullness.qual and + // com.google.errorprone.annotations: + // + // warning: Cannot find annotation method 'value()' in type + // 'EnsuresNonNull': class file for + // org.checkerframework.checker.nullness.qual.EnsuresNonNull not found + // + // warning: Cannot find annotation method 'replacement()' in type + // 'InlineMe': class file for + // com.google.errorprone.annotations.InlineMe not found + // + // The dependency version are taken from: + // https://github.com/google/ExoPlayer/blob/r2.18.1/constants.gradle + // + // For future reference the dependencies are excluded here: + // https://github.com/google/ExoPlayer/blob/r2.18.1/library/common/build.gradle#L33-L34 + dependencies { + add("implementation", "org.checkerframework:checker-qual:3.13.0") + add("implementation", "com.google.errorprone:error_prone_annotations:2.10.0") + } + } +} diff --git a/packages/video_player/video_player_android/example/android/settings.gradle b/packages/video_player/video_player_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/video_player/video_player_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/video_player/video_player_android/example/android/settings.gradle.kts b/packages/video_player/video_player_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/video_player/video_player_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/webview_flutter/webview_flutter/example/android/app/build.gradle b/packages/webview_flutter/webview_flutter/example/android/app/build.gradle deleted file mode 100644 index 9d890e0683c2..000000000000 --- a/packages/webview_flutter/webview_flutter/example/android/app/build.gradle +++ /dev/null @@ -1,62 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.webviewflutterexample" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "io.flutter.plugins.webviewflutterexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/webview_flutter/webview_flutter/example/android/app/build.gradle.kts b/packages/webview_flutter/webview_flutter/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..c2f838005c64 --- /dev/null +++ b/packages/webview_flutter/webview_flutter/example/android/app/build.gradle.kts @@ -0,0 +1,49 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.webviewflutterexample" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.webviewflutterexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/webview_flutter/webview_flutter/example/android/build.gradle b/packages/webview_flutter/webview_flutter/example/android/build.gradle deleted file mode 100644 index b9db5700753a..000000000000 --- a/packages/webview_flutter/webview_flutter/example/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/packages/webview_flutter/webview_flutter/example/android/build.gradle.kts b/packages/webview_flutter/webview_flutter/example/android/build.gradle.kts new file mode 100644 index 000000000000..a8bde37d0c72 --- /dev/null +++ b/packages/webview_flutter/webview_flutter/example/android/build.gradle.kts @@ -0,0 +1,33 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/packages/webview_flutter/webview_flutter/example/android/settings.gradle b/packages/webview_flutter/webview_flutter/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/webview_flutter/webview_flutter/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/webview_flutter/webview_flutter/example/android/settings.gradle.kts b/packages/webview_flutter/webview_flutter/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/webview_flutter/webview_flutter/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 92357d7a3e36..f96b5c98e499 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 4.11.0 + +* Adds support to opt out of Android inset changes. See + `AndroidWebViewController.setInsetsForWebContentToIgnore`. + ## 4.10.15 * Fixes dartdoc comments that accidentally used HTML. diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt index 71d26653c2e6..4f7c259433ac 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.4), do not edit directly. +// Autogenerated from Pigeon (v26.2.0), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -708,6 +708,7 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( value is OverScrollMode || value is SslErrorType || value is MixedContentMode || + value is WindowInsetsType || value == null) { super.writeValue(stream, value) return @@ -1098,6 +1099,47 @@ enum class MixedContentMode(val raw: Int) { } } +/** + * Defines different types of sources causing window insets. + * + * See https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type + */ +enum class WindowInsetsType(val raw: Int) { + /** + * All system bars. + * + * Includes statusBars(), captionBar() as well as navigationBars(), systemOverlays(), but not + * ime(). + */ + SYSTEM_BARS(0), + /** An inset type representing the area that used by DisplayCutout. */ + DISPLAY_CUTOUT(1), + /** An insets type representing the window of a caption bar. */ + CAPTION_BAR(2), + /** An insets type representing the window of an InputMethod. */ + IME(3), + MANDATORY_SYSTEM_GESTURES(4), + /** An insets type representing any system bars for navigation. */ + NAVIGATION_BARS(5), + /** An insets type representing any system bars for displaying status. */ + STATUS_BARS(6), + /** + * An insets type representing the system gesture insets. + * + * The system gesture insets represent the area of a window where system gestures have priority + * and may consume some or all touch input, e.g. due to the a system bar occupying it, or it being + * reserved for touch-only gestures. + */ + SYSTEM_GESTURES(7), + TAPPABLE_ELEMENT(8); + + companion object { + fun ofRaw(raw: Int): WindowInsetsType? { + return values().firstOrNull { it.raw == raw } + } + } +} + private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { @@ -1116,6 +1158,9 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { 133.toByte() -> { return (readValue(buffer) as Long?)?.let { MixedContentMode.ofRaw(it.toInt()) } } + 134.toByte() -> { + return (readValue(buffer) as Long?)?.let { WindowInsetsType.ofRaw(it.toInt()) } + } else -> super.readValueOfType(type, buffer) } } @@ -1142,6 +1187,10 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { stream.write(133) writeValue(stream, value.raw.toLong()) } + is WindowInsetsType -> { + stream.write(134) + writeValue(stream, value.raw.toLong()) + } else -> super.writeValue(stream, value) } } @@ -5316,6 +5365,18 @@ abstract class PigeonApiView( /** Set the over-scroll mode for this view. */ abstract fun setOverScrollMode(pigeon_instance: android.view.View, mode: OverScrollMode) + /** + * Sets the listener to the native method `ViewCompat.setOnApplyWindowInsetsListener` to mark the + * passed insets to zero. + * + * This is a convenience method because `View.OnApplyWindowInsetsListener` requires implementing a + * callback that requires a synchronous return value. + */ + abstract fun setInsetListenerToSetInsetsToZero( + pigeon_instance: android.view.View, + types: List + ) + companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiView?) { @@ -5460,6 +5521,30 @@ abstract class PigeonApiView( channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.View.setInsetListenerToSetInsetsToZero", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val pigeon_instanceArg = args[0] as android.view.View + val typesArg = args[1] as List + val wrapped: List = + try { + api.setInsetListenerToSetInsetsToZero(pigeon_instanceArg, typesArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java index 291767e4bb5d..f5566c533e18 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java @@ -6,6 +6,10 @@ import android.view.View; import androidx.annotation.NonNull; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; +import java.util.List; /** * Flutter API implementation for `View`. @@ -67,4 +71,55 @@ public void setOverScrollMode(@NonNull View pigeon_instance, @NonNull OverScroll throw getPigeonRegistrar().createUnknownEnumException(OverScrollMode.UNKNOWN); } } + + @Override + public void setInsetListenerToSetInsetsToZero( + @NonNull View pigeon_instance, @NonNull List types) { + if (types.isEmpty()) { + ViewCompat.setOnApplyWindowInsetsListener( + pigeon_instance, (view, windowInsets) -> windowInsets); + return; + } + + int typeMaskAccumulator = 0; + for (WindowInsetsType type : types) { + switch (type) { + case SYSTEM_BARS: + typeMaskAccumulator |= WindowInsetsCompat.Type.systemBars(); + break; + case DISPLAY_CUTOUT: + typeMaskAccumulator |= WindowInsetsCompat.Type.displayCutout(); + break; + case CAPTION_BAR: + typeMaskAccumulator |= WindowInsetsCompat.Type.captionBar(); + break; + case IME: + typeMaskAccumulator |= WindowInsetsCompat.Type.ime(); + break; + case MANDATORY_SYSTEM_GESTURES: + typeMaskAccumulator |= WindowInsetsCompat.Type.mandatorySystemGestures(); + break; + case NAVIGATION_BARS: + typeMaskAccumulator |= WindowInsetsCompat.Type.navigationBars(); + break; + case STATUS_BARS: + typeMaskAccumulator |= WindowInsetsCompat.Type.statusBars(); + break; + case SYSTEM_GESTURES: + typeMaskAccumulator |= WindowInsetsCompat.Type.systemGestures(); + break; + case TAPPABLE_ELEMENT: + typeMaskAccumulator |= WindowInsetsCompat.Type.tappableElement(); + break; + } + } + final int insetsTypeMask = typeMaskAccumulator; + + ViewCompat.setOnApplyWindowInsetsListener( + pigeon_instance, + (view, windowInsets) -> + new WindowInsetsCompat.Builder(windowInsets) + .setInsets(insetsTypeMask, Insets.NONE) + .build()); + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java index aef6c6f0a7a6..04e27bf258f3 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java @@ -5,12 +5,21 @@ package io.flutter.plugins.webviewflutter; import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.view.View; +import androidx.core.graphics.Insets; +import androidx.core.view.OnApplyWindowInsetsListener; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; +import java.util.List; import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.MockedStatic; public class ViewTest { @Test @@ -82,4 +91,32 @@ public void setOverScrollMode() { verify(instance).setOverScrollMode(View.OVER_SCROLL_ALWAYS); } + + @Test + public void setInsetListenerToSetInsetsToZero() { + final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); + + final View instance = mock(View.class); + final WindowInsetsCompat originalInsets = + new WindowInsetsCompat.Builder() + .setInsets(WindowInsetsCompat.Type.systemBars(), Insets.of(1, 2, 3, 4)) + .setInsets(WindowInsetsCompat.Type.displayCutout(), Insets.of(4, 5, 6, 7)) + .build(); + + try (MockedStatic viewCompatMockedStatic = mockStatic(ViewCompat.class)) { + api.setInsetListenerToSetInsetsToZero( + instance, List.of(WindowInsetsType.SYSTEM_BARS, WindowInsetsType.DISPLAY_CUTOUT)); + + final ArgumentCaptor listenerCaptor = + ArgumentCaptor.forClass(OnApplyWindowInsetsListener.class); + viewCompatMockedStatic.verify( + () -> ViewCompat.setOnApplyWindowInsetsListener(eq(instance), listenerCaptor.capture())); + + final WindowInsetsCompat newInsets = + listenerCaptor.getValue().onApplyWindowInsets(instance, originalInsets); + + assertEquals(Insets.NONE, newInsets.getInsets(WindowInsetsCompat.Type.systemBars())); + assertEquals(Insets.NONE, newInsets.getInsets(WindowInsetsCompat.Type.displayCutout())); + } + } } diff --git a/packages/webview_flutter/webview_flutter_android/example/android/app/build.gradle b/packages/webview_flutter/webview_flutter_android/example/android/app/build.gradle deleted file mode 100644 index e989fd72d70e..000000000000 --- a/packages/webview_flutter/webview_flutter_android/example/android/app/build.gradle +++ /dev/null @@ -1,70 +0,0 @@ -plugins { - id "com.android.application" - id "org.jetbrains.kotlin.android" - id "dev.flutter.flutter-gradle-plugin" -} - -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -android { - namespace = "io.flutter.plugins.webviewflutterexample" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "io.flutter.plugins.webviewflutterandroidexample" - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug - } - } - lint { - disable 'InvalidPackage' - } -} - -flutter { - source = '../..' -} - -dependencies { - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test:runner:1.2.0") - androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") - api("androidx.test:core:1.4.0") -} diff --git a/packages/webview_flutter/webview_flutter_android/example/android/app/build.gradle.kts b/packages/webview_flutter/webview_flutter_android/example/android/app/build.gradle.kts new file mode 100644 index 000000000000..7870623725c2 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/example/android/app/build.gradle.kts @@ -0,0 +1,49 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "io.flutter.plugins.webviewflutterexample" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + applicationId = "io.flutter.plugins.webviewflutterandroidexample" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + signingConfig = signingConfigs.getByName("debug") + } + } + lint { + disable.add("InvalidPackage") + } +} + +flutter { + source = "../.." +} + +dependencies { + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") + api("androidx.test:core:1.4.0") +} diff --git a/packages/webview_flutter/webview_flutter_android/example/android/build.gradle b/packages/webview_flutter/webview_flutter_android/example/android/build.gradle deleted file mode 100644 index a3e7dce965d2..000000000000 --- a/packages/webview_flutter/webview_flutter_android/example/android/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -allprojects { - repositories { - // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - -// Build the plugin project with warnings enabled. This is here rather than -// in the plugin itself to avoid breaking clients that have different -// warnings (e.g., deprecation warnings from a newer SDK than this project -// builds with). -gradle.projectsEvaluated { - project(":webview_flutter_android") { - tasks.withType(JavaCompile) { - // Ignore classfile due to https://issuetracker.google.com/issues/342067844 - options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" - } - } -} diff --git a/packages/webview_flutter/webview_flutter_android/example/android/build.gradle.kts b/packages/webview_flutter/webview_flutter_android/example/android/build.gradle.kts new file mode 100644 index 000000000000..b9a45dbe39e0 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/example/android/build.gradle.kts @@ -0,0 +1,45 @@ +allprojects { + repositories { + // See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. + val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" + val artifactRepoUrl = System.getenv(artifactRepoKey) + if (artifactRepoUrl != null) { + println("Using artifact hub") + maven { + url = uri(artifactRepoUrl) + } + } + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} + +// Build the plugin project with warnings enabled. This is here rather than +// in the plugin itself to avoid breaking clients that have different +// warnings (e.g., deprecation warnings from a newer SDK than this project +// builds with). +gradle.projectsEvaluated { + project(":webview_flutter_android") { + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/example/android/settings.gradle b/packages/webview_flutter/webview_flutter_android/example/android/settings.gradle deleted file mode 100644 index b542cca3f52e..000000000000 --- a/packages/webview_flutter/webview_flutter_android/example/android/settings.gradle +++ /dev/null @@ -1,27 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.11.1" apply false - id "org.jetbrains.kotlin.android" version "2.2.20" apply false - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - -include ":app" diff --git a/packages/webview_flutter/webview_flutter_android/example/android/settings.gradle.kts b/packages/webview_flutter/webview_flutter_android/example/android/settings.gradle.kts new file mode 100644 index 000000000000..a0118892641d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/example/android/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +// See https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure for more info. +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false + id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1" +} + +include(":app") diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart index 90f5fffb971c..5942f8df08ad 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.4), do not edit directly. +// Autogenerated from Pigeon (v26.2.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -14,11 +14,29 @@ import 'package:flutter/foundation.dart' import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } List wrapResponse({ @@ -675,17 +693,12 @@ class _PigeonInternalInstanceManagerApi { [identifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Clear the native `PigeonInstanceManager`. @@ -701,17 +714,12 @@ class _PigeonInternalInstanceManagerApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } } @@ -866,6 +874,42 @@ enum MixedContentMode { neverAllow, } +/// Defines different types of sources causing window insets. +/// +/// See https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type +enum WindowInsetsType { + /// All system bars. + /// + /// Includes statusBars(), captionBar() as well as navigationBars(), + /// systemOverlays(), but not ime(). + systemBars, + + /// An inset type representing the area that used by DisplayCutout. + displayCutout, + + /// An insets type representing the window of a caption bar. + captionBar, + + /// An insets type representing the window of an InputMethod. + ime, + mandatorySystemGestures, + + /// An insets type representing any system bars for navigation. + navigationBars, + + /// An insets type representing any system bars for displaying status. + statusBars, + + /// An insets type representing the system gesture insets. + /// + /// The system gesture insets represent the area of a window where system + /// gestures have priority and may consume some or all touch input, e.g. due + /// to the a system bar occupying it, or it being reserved for touch-only + /// gestures. + systemGestures, + tappableElement, +} + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -888,6 +932,9 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is MixedContentMode) { buffer.putUint8(133); writeValue(buffer, value.index); + } else if (value is WindowInsetsType) { + buffer.putUint8(134); + writeValue(buffer, value.index); } else { super.writeValue(buffer, value); } @@ -911,6 +958,9 @@ class _PigeonCodec extends StandardMessageCodec { case 133: final value = readValue(buffer) as int?; return value == null ? null : MixedContentMode.values[value]; + case 134: + final value = readValue(buffer) as int?; + return value == null ? null : WindowInsetsType.values[value]; default: return super.readValueOfType(type, buffer); } @@ -1684,17 +1734,12 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -1715,17 +1760,12 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [this, url, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Removes all cookies. @@ -1744,22 +1784,13 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Sets whether the `WebView` should allow third party cookies to be set. @@ -1778,17 +1809,12 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [this, webView, accept], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -1849,17 +1875,12 @@ class WebView extends View { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -2053,17 +2074,12 @@ class WebView extends View { [this, pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -2084,17 +2100,12 @@ class WebView extends View { [this, data, mimeType, encoding], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Loads the given data into this WebView, using baseUrl as the base URL for @@ -2120,17 +2131,12 @@ class WebView extends View { [this, baseUrl, data, mimeType, encoding, historyUrl], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Loads the given URL. @@ -2149,17 +2155,12 @@ class WebView extends View { [this, url, headers], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Loads the URL with postData using "POST" method into this WebView. @@ -2178,17 +2179,12 @@ class WebView extends View { [this, url, data], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Gets the URL for the current page. @@ -2207,17 +2203,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Gets whether this WebView has a back history item. @@ -2236,22 +2228,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Gets whether this WebView has a forward history item. @@ -2270,22 +2253,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Goes back in the history of this WebView. @@ -2304,17 +2278,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Goes forward in the history of this WebView. @@ -2333,17 +2302,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Reloads the current URL. @@ -2362,17 +2326,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Clears the resource cache. @@ -2391,17 +2350,12 @@ class WebView extends View { [this, includeDiskFiles], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Asynchronously evaluates JavaScript in the context of the currently @@ -2421,17 +2375,13 @@ class WebView extends View { [this, javascriptString], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Gets the title for the current page. @@ -2450,17 +2400,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Enables debugging of web contents (HTML / CSS / JavaScript) loaded into @@ -2489,17 +2435,12 @@ class WebView extends View { [enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the WebViewClient that will receive various notifications and @@ -2519,17 +2460,12 @@ class WebView extends View { [this, client], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Injects the supplied Java object into this WebView. @@ -2548,17 +2484,12 @@ class WebView extends View { [this, channel], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Removes a previously injected Java object from this WebView. @@ -2577,17 +2508,12 @@ class WebView extends View { [this, name], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Registers the interface to be used when content can not be handled by the @@ -2607,17 +2533,12 @@ class WebView extends View { [this, listener], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the chrome handler. @@ -2636,17 +2557,12 @@ class WebView extends View { [this, client], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the background color for this view. @@ -2665,17 +2581,12 @@ class WebView extends View { [this, color], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Destroys the internal state of this WebView. @@ -2694,17 +2605,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -2804,17 +2710,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, flag], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Tells JavaScript to open windows automatically. @@ -2833,17 +2734,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, flag], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView whether supports multiple windows. @@ -2862,17 +2758,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, support], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Tells the WebView to enable JavaScript execution. @@ -2891,17 +2782,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, flag], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the WebView's user-agent string. @@ -2920,17 +2806,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, userAgentString], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView requires a user gesture to play media. @@ -2949,17 +2830,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, require], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should support zooming using its on-screen zoom @@ -2979,17 +2855,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, support], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView loads pages in overview mode, that is, zooms out @@ -3009,17 +2880,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, overview], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should enable support for the "viewport" HTML @@ -3039,17 +2905,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, use], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should display on-screen zoom controls when using @@ -3069,17 +2930,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should display on-screen zoom controls when using @@ -3099,17 +2955,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Enables or disables file access within WebView. @@ -3128,17 +2979,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Enables or disables content URL access within WebView. @@ -3157,17 +3003,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether Geolocation is enabled within WebView. @@ -3186,17 +3027,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the text zoom of the page in percent. @@ -3215,17 +3051,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, textZoom], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Gets the WebView's user-agent string. @@ -3244,22 +3075,13 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// Configures the WebView's behavior when handling mixed content. @@ -3278,17 +3100,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, mode], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -3350,17 +3167,12 @@ class JavaScriptChannel extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -3647,17 +3459,12 @@ class WebViewClient extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -5150,17 +4957,12 @@ class WebViewClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -5240,17 +5042,12 @@ class DownloadListener extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -5521,17 +5318,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -6466,17 +6258,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6507,17 +6294,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6548,17 +6330,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6589,17 +6366,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6630,17 +6402,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -6764,17 +6531,12 @@ class FlutterAssetManager extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -6797,22 +6559,13 @@ class FlutterAssetManager extends PigeonInternalProxyApiBaseClass { [this, path], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as List?)!.cast(); - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return (pigeonVar_replyValue as List).cast(); } /// Gets the relative file path to the Flutter asset with the given name, including the file's @@ -6837,22 +6590,13 @@ class FlutterAssetManager extends PigeonInternalProxyApiBaseClass { [this, name], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } @override @@ -6961,17 +6705,12 @@ class WebStorage extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -6992,17 +6731,12 @@ class WebStorage extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7244,17 +6978,12 @@ class PermissionRequest extends PigeonInternalProxyApiBaseClass { [this, resources], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Call this method to deny the request. @@ -7273,17 +7002,12 @@ class PermissionRequest extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7386,17 +7110,12 @@ class CustomViewCallback extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7496,17 +7215,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, x, y], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Move the scrolled position of your view. @@ -7525,17 +7239,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, x, y], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Return the scrolled position of this view. @@ -7554,22 +7263,13 @@ class View extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as WebViewPoint?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as WebViewPoint; } /// Define whether the vertical scrollbar should be drawn or not. @@ -7590,17 +7290,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Define whether the horizontal scrollbar should be drawn or not. @@ -7621,17 +7316,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Set the over-scroll mode for this view. @@ -7650,17 +7340,43 @@ class View extends PigeonInternalProxyApiBaseClass { [this, mode], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + } + + /// Sets the listener to the native method + /// `ViewCompat.setOnApplyWindowInsetsListener` to mark the passed insets to + /// zero. + /// + /// This is a convenience method because `View.OnApplyWindowInsetsListener` + /// requires implementing a callback that requires a synchronous return value. + Future setInsetListenerToSetInsetsToZero( + List types, + ) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecView; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_android.View.setInsetListenerToSetInsetsToZero'; + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [this, types], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7761,17 +7477,12 @@ class GeolocationPermissionsCallback extends PigeonInternalProxyApiBaseClass { [this, origin, allow, retain], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7872,22 +7583,13 @@ class HttpAuthHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Instructs the WebView to cancel the authentication request.. @@ -7906,17 +7608,12 @@ class HttpAuthHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Instructs the WebView to proceed with the authentication with the given @@ -7936,17 +7633,12 @@ class HttpAuthHandler extends PigeonInternalProxyApiBaseClass { [this, username, password], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8049,17 +7741,12 @@ class AndroidMessage extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8161,17 +7848,12 @@ class ClientCertRequest extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Ignore the request for now. @@ -8190,17 +7872,12 @@ class ClientCertRequest extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Proceed with the specified private key and client certificate chain. @@ -8222,17 +7899,12 @@ class ClientCertRequest extends PigeonInternalProxyApiBaseClass { [this, privateKey, chain], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8492,17 +8164,12 @@ class SslErrorHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Instructs the WebView that encountered the SSL certificate error to ignore @@ -8522,17 +8189,12 @@ class SslErrorHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8653,22 +8315,13 @@ class SslError extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as SslErrorType?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as SslErrorType; } /// Determines whether this object includes the supplied error. @@ -8687,22 +8340,13 @@ class SslError extends PigeonInternalProxyApiBaseClass { [this, error], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } @override @@ -8808,22 +8452,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// The distinguished name (normally includes CN, O, and OU names). @@ -8842,22 +8477,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// The most specific Organization (O) component of this name. @@ -8876,22 +8502,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// The most specific Organizational Unit (OU) component of this name. @@ -8910,22 +8527,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } @override @@ -9024,17 +8632,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as SslCertificateDName?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as SslCertificateDName?; } /// Issued-to distinguished name or null if none has been set. @@ -9053,17 +8657,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as SslCertificateDName?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as SslCertificateDName?; } /// Not-after date from the certificate validity period or null if none has been @@ -9083,17 +8683,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as int?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as int?; } /// Not-before date from the certificate validity period or null if none has @@ -9113,17 +8709,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as int?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as int?; } /// The X509Certificate used to create this SslCertificate or null if no @@ -9145,17 +8737,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as X509Certificate?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as X509Certificate?; } @override @@ -9254,22 +8842,13 @@ class Certificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Uint8List?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as Uint8List; } @override @@ -9382,17 +8961,12 @@ class WebSettingsCompat extends PigeonInternalProxyApiBaseClass { [webSettings, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -9499,22 +9073,13 @@ class WebViewFeature extends PigeonInternalProxyApiBaseClass { [feature], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } @override diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 00563080c4ec..f33fba2dc0fa 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -17,6 +17,48 @@ import 'android_webkit_constants.dart'; import 'platform_views_service_proxy.dart'; import 'weak_reference_utils.dart'; +/// Defines different types of sources causing window insets. +/// +/// See https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type +enum AndroidWebViewInsets { + /// All system bars. + /// + /// Includes [statusBars], [captionBar] as well as [navigationBars], but not + /// [ime]. + systemBars, + + /// An inset type representing the area that used by DisplayCutout. + displayCutout, + + /// An inset type representing the window of a caption bar. + captionBar, + + /// An inset type representing the window of an InputMethod. + ime, + + /// An inset type representing the area of a window where mandatory system + /// gestures have priority and may consume some or all touch input, e.g. due + /// to the a system bar occupying it, or it being reserved for touch-only + /// gestures. + mandatorySystemGestures, + + /// An inset type representing any system bars for navigation. + navigationBars, + + /// An inset type representing any system bars for displaying status. + statusBars, + + /// An inset type representing the area of a window where system gestures + /// have priority and may consume some or all touch input, e.g. due to the a + /// system bar occupying it, or it being reserved for touch-only gestures. + systemGestures, + + /// An insets type representing how much tappable elements must at least be + /// inset to remain both tappable and visually unobstructed by persistent + /// system windows. + tappableElement, +} + /// Object specifying parameters for loading a local file in a /// [AndroidWebViewController]. @immutable @@ -861,6 +903,39 @@ class AndroidWebViewController extends PlatformWebViewController { enabled, ); } + + /// Sets the insets that the native View should prevent the web contents from + /// receiving. + Future setInsetsForWebContentToIgnore( + List insets, + ) async { + return _webView.setInsetListenerToSetInsetsToZero( + insets + .map( + (AndroidWebViewInsets inset) => switch (inset) { + AndroidWebViewInsets.systemBars => + android_webview.WindowInsetsType.systemBars, + AndroidWebViewInsets.displayCutout => + android_webview.WindowInsetsType.displayCutout, + AndroidWebViewInsets.captionBar => + android_webview.WindowInsetsType.captionBar, + AndroidWebViewInsets.ime => android_webview.WindowInsetsType.ime, + AndroidWebViewInsets.mandatorySystemGestures => + android_webview.WindowInsetsType.mandatorySystemGestures, + AndroidWebViewInsets.navigationBars => + android_webview.WindowInsetsType.navigationBars, + AndroidWebViewInsets.statusBars => + android_webview.WindowInsetsType.statusBars, + AndroidWebViewInsets.systemGestures => + android_webview.WindowInsetsType.systemGestures, + AndroidWebViewInsets.tappableElement => + android_webview.WindowInsetsType.tappableElement, + }, + ) + .toSet() + .toList(), + ); + } } /// Android implementation of [PlatformWebViewPermissionRequest]. diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart index a6c73ab3e030..4c9aa4cb9d2f 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart @@ -141,6 +141,44 @@ enum MixedContentMode { neverAllow, } +/// Defines different types of sources causing window insets. +/// +/// See https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type +enum WindowInsetsType { + /// All system bars. + /// + /// Includes statusBars(), captionBar() as well as navigationBars(), + /// systemOverlays(), but not ime(). + systemBars, + + /// An inset type representing the area that used by DisplayCutout. + displayCutout, + + /// An insets type representing the window of a caption bar. + captionBar, + + /// An insets type representing the window of an InputMethod. + ime, + + mandatorySystemGestures, + + /// An insets type representing any system bars for navigation. + navigationBars, + + /// An insets type representing any system bars for displaying status. + statusBars, + + /// An insets type representing the system gesture insets. + /// + /// The system gesture insets represent the area of a window where system + /// gestures have priority and may consume some or all touch input, e.g. due + /// to the a system bar occupying it, or it being reserved for touch-only + /// gestures. + systemGestures, + + tappableElement, +} + /// Encompasses parameters to the `WebViewClient.shouldInterceptRequest` method. /// /// See https://developer.android.com/reference/android/webkit/WebResourceRequest. @@ -848,6 +886,14 @@ abstract class View { /// Set the over-scroll mode for this view. void setOverScrollMode(OverScrollMode mode); + + /// Sets the listener to the native method + /// `ViewCompat.setOnApplyWindowInsetsListener` to mark the passed insets to + /// zero. + /// + /// This is a convenience method because `View.OnApplyWindowInsetsListener` + /// requires implementing a callback that requires a synchronous return value. + void setInsetListenerToSetInsetsToZero(List types); } /// A callback interface used by the host application to set the Geolocation diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 30ff682994ac..da5165f07330 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 4.10.15 +version: 4.11.0 environment: sdk: ^3.9.0 @@ -28,7 +28,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^26.1.4 + pigeon: ^26.1.10 topics: - html diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index fa878c5d0da5..e2af88dcacbb 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -2066,6 +2066,31 @@ void main() { expect(expectedEnabled, capturedEnabled); }); + test('setInsetsForWebContentToIgnore', () async { + final mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + for (final AndroidWebViewInsets inset in AndroidWebViewInsets.values) { + await controller.setInsetsForWebContentToIgnore([ + inset, + ]); + + verify( + mockWebView.setInsetListenerToSetInsetsToZero( + [ + android_webview.WindowInsetsType.values.firstWhere(( + android_webview.WindowInsetsType nativeInset, + ) { + return nativeInset.name == inset.name; + }), + ], + ), + ).called(1); + } + }); + group('AndroidWebViewWidget', () { testWidgets('Builds Android view using supplied parameters', ( WidgetTester tester, diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index e5776a14a1a0..afadfb66fa54 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -78,26 +78,26 @@ class _FakeOffset_6 extends _i1.SmartFake implements _i4.Offset { : super(parent, parentInvocation); } -class _FakePigeonInstanceManager_7 extends _i1.SmartFake - implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_7(Object parent, Invocation parentInvocation) +class _FakePlatformViewsServiceProxy_7 extends _i1.SmartFake + implements _i5.PlatformViewsServiceProxy { + _FakePlatformViewsServiceProxy_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakePlatformViewsServiceProxy_8 extends _i1.SmartFake - implements _i5.PlatformViewsServiceProxy { - _FakePlatformViewsServiceProxy_8(Object parent, Invocation parentInvocation) +class _FakePlatformWebViewController_8 extends _i1.SmartFake + implements _i3.PlatformWebViewController { + _FakePlatformWebViewController_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakePlatformWebViewController_9 extends _i1.SmartFake - implements _i3.PlatformWebViewController { - _FakePlatformWebViewController_9(Object parent, Invocation parentInvocation) +class _FakeSize_9 extends _i1.SmartFake implements _i4.Size { + _FakeSize_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeSize_10 extends _i1.SmartFake implements _i4.Size { - _FakeSize_10(Object parent, Invocation parentInvocation) +class _FakePigeonInstanceManager_10 extends _i1.SmartFake + implements _i2.PigeonInstanceManager { + _FakePigeonInstanceManager_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -869,29 +869,14 @@ class MockAndroidWebViewController extends _i1.Mock class MockAndroidWebViewWidgetCreationParams extends _i1.Mock implements _i7.AndroidWebViewWidgetCreationParams { @override - _i2.PigeonInstanceManager get instanceManager => - (super.noSuchMethod( - Invocation.getter(#instanceManager), - returnValue: _FakePigeonInstanceManager_7( - this, - Invocation.getter(#instanceManager), - ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( - this, - Invocation.getter(#instanceManager), - ), - ) - as _i2.PigeonInstanceManager); - - @override _i5.PlatformViewsServiceProxy get platformViewsServiceProxy => (super.noSuchMethod( Invocation.getter(#platformViewsServiceProxy), - returnValue: _FakePlatformViewsServiceProxy_8( + returnValue: _FakePlatformViewsServiceProxy_7( this, Invocation.getter(#platformViewsServiceProxy), ), - returnValueForMissingStub: _FakePlatformViewsServiceProxy_8( + returnValueForMissingStub: _FakePlatformViewsServiceProxy_7( this, Invocation.getter(#platformViewsServiceProxy), ), @@ -911,11 +896,11 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock _i3.PlatformWebViewController get controller => (super.noSuchMethod( Invocation.getter(#controller), - returnValue: _FakePlatformWebViewController_9( + returnValue: _FakePlatformWebViewController_8( this, Invocation.getter(#controller), ), - returnValueForMissingStub: _FakePlatformWebViewController_9( + returnValueForMissingStub: _FakePlatformWebViewController_8( this, Invocation.getter(#controller), ), @@ -1032,10 +1017,10 @@ class MockExpensiveAndroidViewController extends _i1.Mock (super.noSuchMethod( Invocation.method(#setSize, [size]), returnValue: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), returnValueForMissingStub: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), ) as _i8.Future<_i4.Size>); @@ -1111,11 +1096,11 @@ class MockFlutterAssetManager extends _i1.Mock _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1177,11 +1162,11 @@ class MockGeolocationPermissionsCallback extends _i1.Mock _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1247,11 +1232,11 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1291,11 +1276,11 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1519,10 +1504,10 @@ class MockSurfaceAndroidViewController extends _i1.Mock (super.noSuchMethod( Invocation.method(#setSize, [size]), returnValue: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), returnValueForMissingStub: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), ) as _i8.Future<_i4.Size>); @@ -1652,11 +1637,11 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1738,11 +1723,11 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1953,11 +1938,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2249,6 +2234,17 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + + @override + _i8.Future setInsetListenerToSetInsetsToZero( + List<_i2.WindowInsetsType>? types, + ) => + (super.noSuchMethod( + Invocation.method(#setInsetListenerToSetInsetsToZero, [types]), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) + as _i8.Future); } /// A class which mocks [WebViewClient]. @@ -2259,11 +2255,11 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2308,11 +2304,11 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart index eb020a5d61bd..09de377e16ec 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart @@ -672,6 +672,17 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + + @override + _i4.Future setInsetListenerToSetInsetsToZero( + List<_i2.WindowInsetsType>? types, + ) => + (super.noSuchMethod( + Invocation.method(#setInsetListenerToSetInsetsToZero, [types]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WebResourceRequest]. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index efaab280aef5..c36fa74c5831 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.24.3 + +* Adds support to get failing url from DNS errors on iOS 26+. + ## 3.24.2 * Fixes dartdoc comments that accidentally used HTML. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/FrameInfoProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/FrameInfoProxyAPITests.swift index 64ba16774b01..c421d53d7746 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/FrameInfoProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/FrameInfoProxyAPITests.swift @@ -13,27 +13,27 @@ class FrameInfoProxyAPITests: XCTestCase { let registrar = TestProxyApiRegistrar() let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) - let instance: TestFrameInfo? = TestFrameInfo() - let value = try? api.pigeonDelegate.isMainFrame(pigeonApi: api, pigeonInstance: instance!) + let instance = TestFrameInfo.instance + let value = try? api.pigeonDelegate.isMainFrame(pigeonApi: api, pigeonInstance: instance) - XCTAssertEqual(value, instance!.isMainFrame) + XCTAssertEqual(value, instance.isMainFrame) } @MainActor func testRequest() { let registrar = TestProxyApiRegistrar() let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) - let instance: TestFrameInfo? = TestFrameInfo() - let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance!) + let instance = TestFrameInfo.instance + let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) - XCTAssertEqual(value?.value, instance!.request) + XCTAssertEqual(value?.value, instance.request) } @MainActor func testNilRequest() { let registrar = TestProxyApiRegistrar() let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) - let instance = TestFrameInfoWithNilRequest() + let instance = TestFrameInfoWithNilRequest.instance let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) // On macOS 15.5+, `WKFrameInfo.request` returns with an empty URLRequest. // Previously it would return nil so accept either. @@ -46,6 +46,14 @@ class FrameInfoProxyAPITests: XCTestCase { } class TestFrameInfo: WKFrameInfo { + // Global test instance of `WKFrameInfo`. Using a static instance prevents a crash when + // a `WKFrameInfo` is deallocated during a test on iOS 26+. + static let instance = TestFrameInfo() + + private override init() { + + } + override var isMainFrame: Bool { return true } @@ -56,4 +64,11 @@ class TestFrameInfo: WKFrameInfo { } class TestFrameInfoWithNilRequest: WKFrameInfo { + // Global test instance of `WKFrameInfo` with a nil URLRequest. Using a static instance prevents a + // crash when a `WKFrameInfo` is deallocated during a test on iOS 26+. + static let instance = TestFrameInfoWithNilRequest() + + private override init() { + + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationActionProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationActionProxyAPITests.swift index 3d95643d1cbb..3c6d20210cd2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationActionProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationActionProxyAPITests.swift @@ -40,7 +40,7 @@ class NavigationActionProxyAPITests: XCTestCase { } class TestNavigationAction: WKNavigationAction { - let internalTargetFrame = TestFrameInfo() + let internalTargetFrame = TestFrameInfo.instance override var request: URLRequest { return URLRequest(url: URL(string: "http://google.com")!) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift index 081bff28828d..9068f818f0b2 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift @@ -245,8 +245,7 @@ class TestWebView: WKWebView { } class TestURLAuthenticationChallengeSender: NSObject, URLAuthenticationChallengeSender, - @unchecked - Sendable + @unchecked Sendable { func use(_ credential: URLCredential, for challenge: URLAuthenticationChallenge) { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/UIDelegateProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/UIDelegateProxyAPITests.swift index c5cc1a6f34a5..3f672fbc5e41 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/UIDelegateProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/UIDelegateProxyAPITests.swift @@ -39,7 +39,7 @@ class UIDelegateProxyAPITests: XCTestCase { let instance = UIDelegateImpl(api: api, registrar: registrar) let webView = WKWebView(frame: .zero) let origin = SecurityOriginProxyAPITests.testSecurityOrigin - let frame = TestFrameInfo() + let frame = TestFrameInfo.instance let type: WKMediaCaptureType = .camera var resultDecision: WKPermissionDecision? @@ -64,7 +64,7 @@ class UIDelegateProxyAPITests: XCTestCase { let instance = UIDelegateImpl(api: api, registrar: registrar) let webView = WKWebView(frame: .zero) let message = "myString" - let frame = TestFrameInfo() + let frame = TestFrameInfo.instance instance.webView(webView, runJavaScriptAlertPanelWithMessage: message, initiatedByFrame: frame) { @@ -79,7 +79,7 @@ class UIDelegateProxyAPITests: XCTestCase { let instance = UIDelegateImpl(api: api, registrar: registrar) let webView = WKWebView(frame: .zero) let message = "myString" - let frame = TestFrameInfo() + let frame = TestFrameInfo.instance var confirmedResult: Bool? let callbackExpectation = expectation(description: "Wait for callback.") @@ -103,7 +103,7 @@ class UIDelegateProxyAPITests: XCTestCase { let webView = WKWebView(frame: .zero) let prompt = "myString" let defaultText = "myString3" - let frame = TestFrameInfo() + let frame = TestFrameInfo.instance var inputResult: String? let callbackExpectation = expectation(description: "Wait for callback.") diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart index aef35002c5ea..31d2be16c508 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart @@ -51,6 +51,11 @@ class NSErrorUserInfoKey { /// See https://developer.apple.com/documentation/foundation/nsurlerrorfailingurlstringerrorkey?language=objc. static const String NSURLErrorFailingURLStringError = 'NSErrorFailingURLStringKey'; + + /// The URL which caused a load to fail. + /// + /// See https://developer.apple.com/documentation/foundation/nsurlerrorfailingurlerrorkey. + static const String NSURLErrorFailingURLErrorKey = 'NSErrorFailingURLKey'; } /// The authentication method used by the receiver. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart index 6617e5f40598..3dedcc9f2198 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart @@ -1254,17 +1254,22 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { ); } }, - didFailProvisionalNavigation: (_, __, NSError error) { + didFailProvisionalNavigation: (_, __, NSError error) async { + var url = + error.userInfo[NSErrorUserInfoKey.NSURLErrorFailingURLStringError] + as String?; + + // On iOS 26+, the error is stored with `NSURLErrorFailingURLErrorKey`. + if (url == null) { + final nativeURL = + error.userInfo[NSErrorUserInfoKey.NSURLErrorFailingURLErrorKey] + as URL?; + url = await nativeURL?.getAbsoluteString(); + } + if (weakThis.target?._onWebResourceError != null) { weakThis.target!._onWebResourceError!( - WebKitWebResourceError._( - error, - isForMainFrame: true, - url: - error.userInfo[NSErrorUserInfoKey - .NSURLErrorFailingURLStringError] - as String?, - ), + WebKitWebResourceError._(error, isForMainFrame: true, url: url), ); } }, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 7330bbae7e60..1b6268e8f829 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.24.2 +version: 3.24.3 environment: sdk: ^3.9.0 diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart index 0b2fa67c43a2..a359b78639f9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart @@ -287,6 +287,55 @@ void main() { expect(callbackError.isForMainFrame, true); }); + test( + 'onWebResourceError can receive DNS errors from didFailProvisionalNavigation', + () async { + PigeonOverrides.wKNavigationDelegate_new = + CapturingNavigationDelegate.new; + final webKitDelegate = WebKitNavigationDelegate( + const WebKitNavigationDelegateCreationParams(), + ); + + late final WebKitWebResourceError callbackError; + void onWebResourceError(WebResourceError error) { + callbackError = error as WebKitWebResourceError; + } + + await webKitDelegate.setOnWebResourceError(onWebResourceError); + + CapturingNavigationDelegate + .lastCreatedDelegate + .didFailProvisionalNavigation!( + WKNavigationDelegate.pigeon_detached( + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + ); + }, + ), + WKWebView.pigeon_detached(), + NSError.pigeon_detached( + code: WKErrorCode.webViewInvalidated, + domain: 'domain', + userInfo: const { + NSErrorUserInfoKey.NSURLErrorFailingURLStringError: + 'www.flutter.dev', + NSErrorUserInfoKey.NSLocalizedDescription: 'my desc', + }, + ), + ); + + expect(callbackError.url, 'www.flutter.dev'); + }, + ); + test( 'onWebResourceError from webViewWebContentProcessDidTerminate', () async { diff --git a/packages/xdg_directories/example/linux/flutter/generated_plugins.cmake b/packages/xdg_directories/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/packages/xdg_directories/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/script/configs/allowed_unpinned_deps.yaml b/script/configs/allowed_unpinned_deps.yaml index f139fc20c341..d5384884c993 100644 --- a/script/configs/allowed_unpinned_deps.yaml +++ b/script/configs/allowed_unpinned_deps.yaml @@ -43,6 +43,9 @@ - intl - io - js +- jni +- jni_flutter +- jnigen - json_serializable - leak_tracker - leak_tracker_flutter_testing diff --git a/script/configs/xcode_warnings_exceptions.yaml b/script/configs/xcode_warnings_exceptions.yaml index e57565b87b18..f2751a87a62d 100644 --- a/script/configs/xcode_warnings_exceptions.yaml +++ b/script/configs/xcode_warnings_exceptions.yaml @@ -7,3 +7,7 @@ # TODO(loicsharma): Remove once AppAuth-iOS's warnings are fixed. # See: https://github.com/flutter/flutter/issues/162342 - google_sign_in_ios + +# TODO(okorohelijah): Remove once Google-Maps-iOS-Utils's warnings are fixed upstream. +# See: https://github.com/flutter/flutter/issues/184470 +- google_maps_flutter_ios diff --git a/script/tool/lib/src/analyze_command.dart b/script/tool/lib/src/analyze_command.dart index 216f8c75811c..91f247eed2c2 100644 --- a/script/tool/lib/src/analyze_command.dart +++ b/script/tool/lib/src/analyze_command.dart @@ -371,10 +371,11 @@ class AnalyzeCommand extends PackageLoopingCommand { RepositoryPackage package, ) async { if (!pluginSupportsPlatform( - platformAndroid, - package, - requiredMode: PlatformSupport.inline, - )) { + platformAndroid, + package, + requiredMode: PlatformSupport.inline, + ) || + !package.platformDirectory(FlutterPlatform.android).existsSync()) { return PackageResult.skip( 'Package does not contain native Android plugin code', ); diff --git a/script/tool/lib/src/gradle_check_command.dart b/script/tool/lib/src/gradle_check_command.dart index 499b332177cd..16fb59e4b106 100644 --- a/script/tool/lib/src/gradle_check_command.dart +++ b/script/tool/lib/src/gradle_check_command.dart @@ -9,10 +9,8 @@ import 'package:file/file.dart'; import 'package:meta/meta.dart'; import 'package:pub_semver/pub_semver.dart'; -import 'common/core.dart'; import 'common/output_utils.dart'; import 'common/package_looping_command.dart'; -import 'common/plugin_utils.dart'; import 'common/repository_package.dart'; /// The lowest `ext.kotlin_version` that example apps are allowed to use. @@ -67,7 +65,6 @@ class GradleCheckCommand extends PackageLoopingCommand { FlutterPlatform.android, ); final File topLevelGradleFile = _getBuildGradleFile(androidDir); - final bool isKts = topLevelGradleFile.path.endsWith('.kts'); // 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. @@ -82,7 +79,6 @@ class GradleCheckCommand extends PackageLoopingCommand { if (!_validateExampleTopLevelSettingsGradle( package, topLevelSettingsGradleFile, - isKts: isKts, )) { succeeded = false; } @@ -146,31 +142,25 @@ class GradleCheckCommand extends PackageLoopingCommand { '${indentation}Validating ' '${getRelativePosixPath(gradleFile, from: package.directory)}.', ); - final bool isKts = gradleFile.path.endsWith('.kts'); final String contents = gradleFile.readAsStringSync(); final List lines = contents.split('\n'); // 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. var succeeded = true; - if (!_validateNamespace( - package, - contents, - isExample: false, - isKts: isKts, - )) { + if (!_validateNamespace(package, contents, isExample: false)) { succeeded = false; } - if (!_validateCompatibilityVersions(lines, isKts: isKts)) { + if (!_validateCompatibilityVersions(lines)) { succeeded = false; } - if (!_validateKotlinJvmCompatibility(lines, isKts: isKts)) { + if (!_validateKotlinJvmCompatibility(lines)) { succeeded = false; } - if (!_validateJavaKotlinCompileOptionsAlignment(lines, isKts: isKts)) { + if (!_validateJavaKotlinCompileOptionsAlignment(lines)) { succeeded = false; } - if (!_validateGradleDrivenLintConfig(lines, isKts: isKts)) { + if (!_validateGradleDrivenLintConfig(lines)) { succeeded = false; } if (!_validateCompileSdkUsage(package, lines)) { @@ -184,23 +174,10 @@ class GradleCheckCommand extends PackageLoopingCommand { static const String artifactHubDocumentationString = r'https://github.com/flutter/flutter/blob/master/docs/ecosystem/Plugins-and-Packages-repository-structure.md#gradle-structure'; - /// String printed as example of valid example root build.gradle repository - /// configuration that enables artifact hub env variable. + /// String printed as example of valid example root build.gradle.kts + /// repository configuration that enables artifact hub env variable. @visibleForTesting - static const String exampleGroovyRootGradleArtifactHubString = - ''' - // See $artifactHubDocumentationString for more info. - def artifactRepoKey = 'ARTIFACT_HUB_REPOSITORY' - if (System.getenv().containsKey(artifactRepoKey)) { - println "Using artifact hub" - maven { url System.getenv(artifactRepoKey) } - } -'''; - - /// String printed as example of valid example root build.gradle.kts repository - /// configuration that enables artifact hub env variable. - @visibleForTesting - static const String exampleKotlinRootGradleArtifactHubString = + static const String exampleRootGradleArtifactHubString = ''' // See $artifactHubDocumentationString for more info. val artifactRepoKey = "ARTIFACT_HUB_REPOSITORY" @@ -219,9 +196,8 @@ class GradleCheckCommand extends PackageLoopingCommand { /// Required in root gradle file. bool _validateArtifactHubUsage( RepositoryPackage example, - List gradleLines, { - required bool isKts, - }) { + List gradleLines, + ) { // Gradle variable name used to hold environment variable string. const keyVariable = 'artifactRepoKey'; const urlVariable = 'artifactRepoUrl'; @@ -232,27 +208,17 @@ class GradleCheckCommand extends PackageLoopingCommand { final documentationPresentRegex = RegExp( r'github\.com.*flutter.*blob.*Plugins-and-Packages-repository-structure.*gradle-structure', ); - final keyReadRegex = isKts - ? RegExp( - '$urlVariable' - r'\s*=\s*System\.getenv\(' - '$keyVariable' - r'\)', - ) - : RegExp( - r'if.*System\.getenv.*\.containsKey.*' - '$keyVariable', - ); - final keyUsedRegex = isKts - ? RegExp( - r'url = uri\(' - '$urlVariable' - r'\)', - ) - : RegExp( - r'maven.*url.*System\.getenv\(' - '$keyVariable', - ); + final keyReadRegex = RegExp( + '$urlVariable' + r'\s*=\s*System\.getenv\(' + '$keyVariable' + r'\)', + ); + final keyUsedRegex = RegExp( + r'url = uri\(' + '$urlVariable' + r'\)', + ); final bool keyPresent = gradleLines.any( (String line) => keyPresentRegex.hasMatch(line), @@ -268,12 +234,9 @@ class GradleCheckCommand extends PackageLoopingCommand { ); if (!(documentationPresent && keyPresent && keyRead && keyUsed)) { - final String exampleString = isKts - ? exampleKotlinRootGradleArtifactHubString - : exampleGroovyRootGradleArtifactHubString; printError( 'Failed Artifact Hub validation. Include the following in ' - 'example root build.gradle:\n$exampleString', + 'example root build.gradle:\n$exampleRootGradleArtifactHubString', ); } @@ -284,9 +247,8 @@ class GradleCheckCommand extends PackageLoopingCommand { /// some_package/example/android/settings.gradle). bool _validateExampleTopLevelSettingsGradle( RepositoryPackage package, - File gradleSettingsFile, { - required bool isKts, - }) { + File gradleSettingsFile, + ) { print( '${indentation}Validating ' '${getRelativePosixPath(gradleSettingsFile, from: package.directory)}.', @@ -296,27 +258,19 @@ 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. var succeeded = true; - if (!_validateArtifactHubSettingsUsage(package, lines, isKts: isKts)) { + if (!_validateArtifactHubSettingsUsage(package, lines)) { + succeeded = false; + } + if (!_validateKotlinVersion(package, lines)) { succeeded = false; } return succeeded; } - /// String printed as a valid example of settings.gradle repository - /// configuration that enables artifact hub env variable. - @visibleForTesting - static const String exampleGroovySettingsArtifactHubString = ''' -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - // ...other plugins - id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.1" -} - '''; - /// String printed as a valid example of settings.gradle.kts repository /// configuration that enables artifact hub env variable. @visibleForTesting - static const String exampleKotlinSettingsArtifactHubString = ''' + static const String exampleSettingsArtifactHubString = ''' plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" // ...other plugins @@ -330,9 +284,8 @@ plugins { /// Required in root gradle file. bool _validateArtifactHubSettingsUsage( RepositoryPackage example, - List gradleLines, { - required bool isKts, - }) { + List gradleLines, + ) { final documentationPresentRegex = RegExp( r'github\.com.*flutter.*blob.*Plugins-and-Packages-repository-structure.*gradle-structure', ); @@ -358,12 +311,9 @@ plugins { ); } if (!declarativeArtifactRegistryApplied) { - final String exampleString = isKts - ? exampleKotlinSettingsArtifactHubString - : exampleGroovySettingsArtifactHubString; printError( 'Include the following in ' - 'example root settings.gradle:\n$exampleString', + 'example root settings.gradle:\n$exampleSettingsArtifactHubString', ); } } @@ -380,7 +330,6 @@ plugins { '${indentation}Validating ' '${getRelativePosixPath(gradleFile, from: package.directory)}.', ); - final bool isKts = gradleFile.path.endsWith('.kts'); final String contents = gradleFile.readAsStringSync(); final List lines = contents.split('\n'); @@ -390,10 +339,7 @@ plugins { if (!_validateJavacLintConfig(package, lines)) { succeeded = false; } - if (!_validateKotlinVersion(package, lines, isKts: isKts)) { - succeeded = false; - } - if (!_validateArtifactHubUsage(package, lines, isKts: isKts)) { + if (!_validateArtifactHubUsage(package, lines)) { succeeded = false; } return succeeded; @@ -409,13 +355,12 @@ plugins { '${indentation}Validating ' '${getRelativePosixPath(gradleFile, from: package.directory)}.', ); - final bool isKts = gradleFile.path.endsWith('.kts'); final String contents = gradleFile.readAsStringSync(); // 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. var succeeded = true; - if (!_validateNamespace(package, contents, isExample: true, isKts: isKts)) { + if (!_validateNamespace(package, contents, isExample: true)) { succeeded = false; } return succeeded; @@ -427,7 +372,6 @@ plugins { RepositoryPackage package, String gradleContents, { required bool isExample, - required bool isKts, }) { // Regex to validate that the following namespace definition // is found (where the single quotes can be single or double): @@ -441,9 +385,8 @@ plugins { ); if (nameSpaceRegexMatch == null) { - final errorMessage = - ''' -build.gradle${isKts ? '.kts' : ''} must set a "namespace": + const errorMessage = ''' +build.gradle.kts must set a "namespace": android { namespace = "dev.flutter.foo" @@ -463,7 +406,6 @@ https://developer.android.com/build/publish-library/prep-lib-release#choose-name package, isExample: isExample, namespace: nameSpaceRegexMatch.group(1)!, - isKts: isKts, ); } } @@ -477,7 +419,6 @@ https://developer.android.com/build/publish-library/prep-lib-release#choose-name RepositoryPackage package, { required bool isExample, required String namespace, - required bool isKts, }) { final manifestPackageRegex = RegExp(r'package\s*=\s*"(.*?)"'); final String manifestContents = _getMainAndroidManifest( @@ -488,7 +429,7 @@ https://developer.android.com/build/publish-library/prep-lib-release#choose-name manifestContents, ); if (packageMatch != null && namespace != packageMatch.group(1)) { - final buildGradleName = 'build.gradle${isKts ? '.kts' : ''}'; + const buildGradleName = 'build.gradle.kts'; final errorMessage = ''' $buildGradleName "namespace" must match the "package" attribute in AndroidManifest.xml, if one is present. @@ -506,10 +447,7 @@ $buildGradleName "namespace" must match the "package" attribute in AndroidManife /// Checks for a source compatibiltiy version, so that it's explicit rather /// 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, { - required bool isKts, - }) { + bool _validateCompatibilityVersions(List gradleLines) { final bool hasLanguageVersion = gradleLines.any( (String line) => line.contains('languageVersion') && !_isCommented(line), ); @@ -530,9 +468,9 @@ $buildGradleName "namespace" must match the "package" attribute in AndroidManife !_isCommented(line), ); if (!hasLanguageVersion && !hasCompabilityVersions) { - final javaErrorMessage = + const javaErrorMessage = ''' -build.gradle${isKts ? '.kts' : ''} must set an explicit Java compatibility version. +build.gradle.kts must set an explicit Java compatibility version. This can be done either via "sourceCompatibility"/"targetCompatibility": android { @@ -562,10 +500,7 @@ for more details.'''; return true; } - bool _validateKotlinJvmCompatibility( - List gradleLines, { - required bool isKts, - }) { + bool _validateKotlinJvmCompatibility(List gradleLines) { bool isKotlinOptions(String line) => line.contains('kotlinOptions') && !_isCommented(line); final bool hasKotlinOptions = gradleLines.any(isKotlinOptions); @@ -590,7 +525,7 @@ for more details.'''; } final kotlinErrorMessage = ''' -If build.gradle${isKts ? '.kts' : ''} sets jvmTarget then it must use JavaVersion syntax. +If build.gradle.kts sets jvmTarget then it must use JavaVersion syntax. Good: android { kotlinOptions { @@ -609,11 +544,7 @@ If build.gradle${isKts ? '.kts' : ''} sets jvmTarget then it must use JavaVersio return true; } - bool _validateJavaKotlinCompileOptionsAlignment( - List gradleLines, { - required bool isKts, - }) { - final buildGradleName = 'build.gradle${isKts ? '.kts' : ''}'; + bool _validateJavaKotlinCompileOptionsAlignment(List gradleLines) { final javaVersions = []; // Some java versions have the format VERSION_1_8 but we dont need to handle those // because they are below the minimum. @@ -632,9 +563,8 @@ If build.gradle${isKts ? '.kts' : ''} sets jvmTarget then it must use JavaVersio if (javaVersions.isNotEmpty) { final int version = int.parse(javaVersions.first); if (!javaVersions.every((String element) => element == '$version')) { - final javaVersionAlignmentError = - ''' -If $buildGradleName uses JavaVersion.* versions must be the same. + const javaVersionAlignmentError = ''' +If build.gradle.kts uses JavaVersion.* versions must be the same. '''; printError( '$indentation${javaVersionAlignmentError.split('\n').join('\n$indentation')}', @@ -645,7 +575,7 @@ If $buildGradleName uses JavaVersion.* versions must be the same. if (version < _minimumJavaVersion) { final minimumJavaVersionError = ''' -$buildGradleName uses "JavaVersion.VERSION_$version". +build.gradle.kts uses "JavaVersion.VERSION_$version". Which is below the minimum required. Use at least "JavaVersion.VERSION_$_minimumJavaVersion". '''; printError( @@ -661,10 +591,7 @@ Which is below the minimum required. Use at least "JavaVersion.VERSION_$_minimum /// Returns whether the given gradle content is configured to enable all /// Gradle-driven lints (those checked by ./gradlew lint) and treat them as /// errors. - bool _validateGradleDrivenLintConfig( - List gradleLines, { - required bool isKts, - }) { + bool _validateGradleDrivenLintConfig(List gradleLines) { if (!gradleLines.any( (String line) => line.contains('checkAllWarnings = true') && !_isCommented(line), @@ -677,7 +604,7 @@ Which is below the minimum required. Use at least "JavaVersion.VERSION_$_minimum '${indentation}This package is not configured to enable all ' 'Gradle-driven lint warnings and treat them as errors. ' 'Please add the following to the lintOptions section of ' - 'android/build.gradle${isKts ? '.kts' : ''}:', + 'android/build.gradle.kts:', ); print(''' checkAllWarnings = true @@ -788,11 +715,12 @@ Which is below the minimum required. Use at least "JavaVersion.VERSION_$_minimum List gradleLines, ) { final RepositoryPackage enclosingPackage = example.getEnclosingPackage()!; - if (!pluginSupportsPlatform( - platformAndroid, - enclosingPackage, - requiredMode: PlatformSupport.inline, - )) { + // This checks for android/ rather than using pluginSupportsPlatform because + // Dart-only implementations (e.g., usin jnigen) won't have this + // configuration since there's no native plugin code to check. + if (!enclosingPackage + .platformDirectory(FlutterPlatform.android) + .existsSync()) { return true; } final String enclosingPackageName = enclosingPackage.directory.basename; @@ -833,10 +761,11 @@ gradle.projectsEvaluated { /// least a minimum value, if it is set at all. bool _validateKotlinVersion( RepositoryPackage example, - List gradleLines, { - required bool isKts, - }) { - final kotlinVersionRegex = RegExp(r"ext\.kotlin_version\s*=\s*'([\d.]+)'"); + List gradleLines, + ) { + final kotlinVersionRegex = RegExp( + r'id\("org\.jetbrains\.kotlin\.android"\) version "([\d.]+)"', + ); RegExpMatch? match; if (gradleLines.any((String line) { match = kotlinVersionRegex.firstMatch(line); @@ -845,9 +774,10 @@ gradle.projectsEvaluated { final version = Version.parse(match!.group(1)!); if (version < minKotlinVersion) { printError( - 'build.gradle${isKts ? '.kts' : ''} sets "ext.kotlin_version" to "$version". The ' - 'minimum Kotlin version that can be specified is ' - '$minKotlinVersion, for compatibility with modern dependencies.', + 'settings.gradle.kts sets the "org.jetbrains.kotlin.android" ' + 'plugin version to "$version". The minimum Kotlin version that can ' + 'be specified is $minKotlinVersion, for compatibility with modern ' + 'dependencies.', ); return false; } diff --git a/script/tool/lib/src/update_excerpts_command.dart b/script/tool/lib/src/update_excerpts_command.dart index 577b08ebfe38..539fcc241eef 100644 --- a/script/tool/lib/src/update_excerpts_command.dart +++ b/script/tool/lib/src/update_excerpts_command.dart @@ -148,6 +148,7 @@ class UpdateExcerptsCommand extends PackageLoopingCommand { case '': language = 'txt'; case '.kt': + case '.kts': language = 'kotlin'; case '.cc': case '.cpp': diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index 7fea963b0292..3454c7e08890 100644 --- a/script/tool/lib/src/version_check_command.dart +++ b/script/tool/lib/src/version_check_command.dart @@ -248,7 +248,7 @@ class VersionCheckCommand extends PackageLoopingCommand { // PR with post release label is going to sync changelog.md and pubspec.yaml // change back to main branch. Proceed with regular version check. final bool hasPostReleaseLabel = _prLabels.contains( - 'post-release-${pubspec.name}', + 'override: post-release-${pubspec.name}', ); bool versionChanged; diff --git a/script/tool/test/analyze_command_test.dart b/script/tool/test/analyze_command_test.dart index ef2a609579ac..2cc4947e6d29 100644 --- a/script/tool/test/analyze_command_test.dart +++ b/script/tool/test/analyze_command_test.dart @@ -57,6 +57,9 @@ void main() { platformMacOS: const PlatformDetails(PlatformSupport.inline), }, ); + plugin + .platformDirectory(FlutterPlatform.android) + .createSync(recursive: true); // Simulate Android analysis failure only. final String gradlewPath = plugin @@ -793,6 +796,9 @@ packages/package_a/CHANGELOG.md platformAndroid: const PlatformDetails(PlatformSupport.inline), }, ); + plugin + .platformDirectory(FlutterPlatform.android) + .createSync(recursive: true); final Directory androidDir = plugin.getExamples().first.platformDirectory( FlutterPlatform.android, @@ -836,6 +842,9 @@ packages/package_a/CHANGELOG.md platformAndroid: const PlatformDetails(PlatformSupport.inline), }, ); + plugin + .platformDirectory(FlutterPlatform.android) + .createSync(recursive: true); final Iterable exampleAndroidDirs = plugin.getExamples().map( (RepositoryPackage example) => @@ -875,6 +884,9 @@ packages/package_a/CHANGELOG.md platformAndroid: const PlatformDetails(PlatformSupport.inline), }, ); + plugin + .platformDirectory(FlutterPlatform.android) + .createSync(recursive: true); final Directory androidDir = plugin.getExamples().first.platformDirectory( FlutterPlatform.android, @@ -910,13 +922,16 @@ packages/package_a/CHANGELOG.md }); test('fails if gradlew generation fails', () async { - createFakePlugin( + final RepositoryPackage plugin = createFakePlugin( 'plugin1', packagesDir, platformSupport: { platformAndroid: const PlatformDetails(PlatformSupport.inline), }, ); + plugin + .platformDirectory(FlutterPlatform.android) + .createSync(recursive: true); processRunner.mockProcessesForExecutable[getFlutterCommand( mockPlatform, @@ -951,6 +966,9 @@ packages/package_a/CHANGELOG.md platformAndroid: const PlatformDetails(PlatformSupport.inline), }, ); + plugin + .platformDirectory(FlutterPlatform.android) + .createSync(recursive: true); final String gradlewPath = plugin .getExamples() @@ -1024,6 +1042,31 @@ packages/package_a/CHANGELOG.md ); }); + test('skips Dart-only plugins', () async { + createFakePlugin( + 'plugin1', + packagesDir, + platformSupport: { + platformAndroid: const PlatformDetails(PlatformSupport.inline), + }, + ); + + final List output = await runCapturingPrint(runner, [ + 'analyze', + '--android', + '--no-dart', + ]); + + expect( + output, + containsAllInOrder([ + contains( + 'SKIPPING: Package does not contain native Android plugin code', + ), + ]), + ); + }); + group('file filtering', () { const files = ['foo.java', 'foo.kt']; for (final file in files) { diff --git a/script/tool/test/gradle_check_command_test.dart b/script/tool/test/gradle_check_command_test.dart index c4fe9345d007..6ce23bb334ca 100644 --- a/script/tool/test/gradle_check_command_test.dart +++ b/script/tool/test/gradle_check_command_test.dart @@ -17,9 +17,7 @@ const String _defaultFakeNamespace = 'dev.flutter.foo'; void main() { late CommandRunner runner; late Directory packagesDir; - const groovyJavaIncompatabilityIndicator = - 'build.gradle must set an explicit Java compatibility version.'; - const kotlinJavaIncompatabilityIndicator = + const javaIncompatabilityIndicator = 'build.gradle.kts must set an explicit Java compatibility version.'; setUp(() { @@ -35,104 +33,9 @@ void main() { runner.addCommand(command); }); - /// Writes a fake android/build.gradle file for plugin [package] with the - /// given options. - void writeFakeGroovyPluginBuildGradle( - RepositoryPackage package, { - bool includeLanguageVersion = false, - bool includeSourceCompat = false, - bool includeTargetCompat = false, - bool commentSourceLanguage = false, - bool includeNamespace = true, - bool commentNamespace = false, - bool warningsConfigured = true, - bool useDeprecatedCompileSdkVersion = false, - bool usePropertyAssignment = true, - String compileSdk = '36', - bool includeKotlinOptions = true, - bool commentKotlinOptions = false, - bool useDeprecatedJvmTargetStyle = false, - int jvmTargetValue = 17, - int kotlinJvmValue = 17, - }) { - final File buildGradle = package - .platformDirectory(FlutterPlatform.android) - .childFile('build.gradle'); - buildGradle.createSync(recursive: true); - - const warningConfig = ''' - lintOptions { - checkAllWarnings = true - warningsAsErrors = true - disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency', 'NewerVersionAvailable' - baseline file("lint-baseline.xml") - } -'''; - final javaSection = - ''' -java { - toolchain { - ${commentSourceLanguage ? '// ' : ''}languageVersion = JavaLanguageVersion.of(8) - } -} - -'''; - final sourceCompat = - '${commentSourceLanguage ? '// ' : ''}sourceCompatibility = JavaVersion.VERSION_$jvmTargetValue'; - final targetCompat = - '${commentSourceLanguage ? '// ' : ''}targetCompatibility = JavaVersion.VERSION_$jvmTargetValue'; - final namespace = - " ${commentNamespace ? '// ' : ''}namespace = '$_defaultFakeNamespace'"; - final kotlinJvmTarget = useDeprecatedJvmTargetStyle - ? '$jvmTargetValue' - : 'JavaVersion.VERSION_$kotlinJvmValue.toString()'; - final kotlinConfig = - ''' - ${commentKotlinOptions ? '//' : ''}kotlinOptions { - ${commentKotlinOptions ? '//' : ''}jvmTarget = $kotlinJvmTarget - ${commentKotlinOptions ? '//' : ''}}'''; - - buildGradle.writeAsStringSync(''' -group 'dev.flutter.plugins.fake' -version '1.0-SNAPSHOT' - -buildscript { - repositories { - google() - mavenCentral() - } -} - -apply plugin: 'com.android.library' - -${includeLanguageVersion ? javaSection : ''} -android { -${includeNamespace ? namespace : ''} - ${useDeprecatedCompileSdkVersion ? 'compileSdkVersion' : 'compileSdk'} ${usePropertyAssignment ? '=' : ''} $compileSdk - - defaultConfig { - minSdk ${usePropertyAssignment ? '=' : ''} 30 - } -${warningsConfigured ? warningConfig : ''} - compileOptions { - ${includeSourceCompat ? sourceCompat : ''} - ${includeTargetCompat ? targetCompat : ''} - } - ${includeKotlinOptions ? kotlinConfig : ''} - testOptions { - unitTests.includeAndroidResources = true - } -} - -dependencies { - implementation 'fake.package:fake:1.0.0' -} -'''); - } - /// Writes a fake android/build.gradle.kts file for plugin [package] with the /// given options. - void writeFakeKotlinPluginBuildGradle( + void writeFakePluginBuildGradle( RepositoryPackage package, { bool includeLanguageVersion = false, bool includeSourceCompat = false, @@ -196,7 +99,17 @@ buildscript { } } -apply plugin: 'com.android.library' +allprojects { + repositories { + google() + mavenCentral() + } +} + +plugins { + id("com.android.library") + id("kotlin-android") +} ${includeLanguageVersion ? javaSection : ''} android { @@ -225,95 +138,34 @@ dependencies { '''); } - /// Writes a fake android/build.gradle file for an example [package] with the - /// given options. - // TODO(stuartmorgan): Once all packages are migrated to Kotlin, remove all - // the Groovy variants, and switch all tests to the Kotlin variants. - void writeFakeGroovyExampleTopLevelBuildGradle( + /// Writes a fake android/build.gradle.kts file for an example [package] with + /// the given options. + void writeFakeExampleTopLevelBuildGradle( RepositoryPackage package, { required String pluginName, - required bool warningsConfigured, - String? kotlinVersion, + bool warningsConfigured = true, bool includeArtifactHub = true, }) { final File buildGradle = package .platformDirectory(FlutterPlatform.android) - .childFile('build.gradle'); + .childFile('build.gradle.kts'); buildGradle.createSync(recursive: true); final warningConfig = ''' gradle.projectsEvaluated { project(":$pluginName") { - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + tasks.withType { + options.compilerArgs.addAll(listOf("-Xlint:all", "-Werror")) } } } '''; - buildGradle.writeAsStringSync(''' -buildscript { - ${kotlinVersion == null ? '' : "ext.kotlin_version = '$kotlinVersion'"} - repositories { - ${includeArtifactHub ? GradleCheckCommand.exampleGroovyRootGradleArtifactHubString : ''} - google() - mavenCentral() - } - - dependencies { - classpath 'fake.package:fake:1.0.0' - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "\${rootProject.buildDir}/\${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} - -${warningsConfigured ? warningConfig : ''} -'''); - } - - /// Writes a fake android/build.gradle.kts file for an example [package] with - /// the given options. - void writeFakeKotlinExampleTopLevelBuildGradle( - RepositoryPackage package, { - required String pluginName, - bool warningsConfigured = true, - bool includeArtifactHub = true, - }) { - final File buildGradle = package - .platformDirectory(FlutterPlatform.android) - .childFile('build.gradle.kts'); - buildGradle.createSync(recursive: true); - - // TODO(stuartmorgan): Add support for warningsConfigured when we start - // migrating plugins to Kotlin Gradle. See Groovy variant above. For now, - // throw if any test requires warnings. - if (warningsConfigured) { - throw UnimplementedError( - 'warningsConfigured is not yet supported for Kotlin Gradle', - ); - } buildGradle.writeAsStringSync(''' allprojects { repositories { - ${includeArtifactHub ? GradleCheckCommand.exampleKotlinRootGradleArtifactHubString : ''} + ${includeArtifactHub ? GradleCheckCommand.exampleRootGradleArtifactHubString : ''} google() mavenCentral() } @@ -336,59 +188,16 @@ subprojects { tasks.register("clean") { delete(rootProject.layout.buildDirectory) } -'''); - } - - /// Writes a fake android/build.gradle file for an example [package] with the - /// given options. - void writeFakeGroovyExampleSettingsGradle( - RepositoryPackage package, { - bool includeArtifactHub = true, - bool includeArtifactDocumentation = true, - }) { - final File settingsGradle = package - .platformDirectory(FlutterPlatform.android) - .childFile('settings.gradle'); - settingsGradle.createSync(recursive: true); - - /// String printed as a valid example of settings.gradle repository - /// configuration without the artifact hub env variable. - const exampleSettingsWithoutArtifactHubString = ''' -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - // ...other plugins -} - '''; - settingsGradle.writeAsStringSync(''' -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("\$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -${includeArtifactDocumentation ? '// See ${GradleCheckCommand.artifactHubDocumentationString} for more info.' : ''} -${includeArtifactHub ? GradleCheckCommand.exampleGroovySettingsArtifactHubString : exampleSettingsWithoutArtifactHubString} -include ":app" +${warningsConfigured ? warningConfig : ''} '''); } - /// Writes a fake android/build.gradle file for an example [package] with the - /// given options. - void writeFakeKotlinExampleSettingsGradle( + /// Writes a fake android/settings.gradle.kts file for an example [package] + /// with the given options. + void writeFakeExampleSettingsGradle( RepositoryPackage package, { + required String kotlinVersion, bool includeArtifactHub = true, bool includeArtifactDocumentation = true, }) { @@ -397,15 +206,6 @@ include ":app" .childFile('settings.gradle.kts'); settingsGradle.createSync(recursive: true); - /// String printed as a valid example of settings.gradle repository - /// configuration without the artifact hub env variable. - const exampleSettingsWithoutArtifactHubString = ''' -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - // ...other plugins -} - '''; - settingsGradle.writeAsStringSync(''' pluginManagement { val flutterSdkPath = @@ -427,65 +227,20 @@ pluginManagement { } ${includeArtifactDocumentation ? '// See ${GradleCheckCommand.artifactHubDocumentationString} for more info.' : ''} -${includeArtifactHub ? GradleCheckCommand.exampleKotlinSettingsArtifactHubString : exampleSettingsWithoutArtifactHubString} -include ":app" -'''); - } - - /// Writes a fake android/app/build.gradle file for an example [package] with - /// the given options. - void writeFakeGroovyExampleAppBuildGradle( - RepositoryPackage package, { - required bool includeNamespace, - required bool commentNamespace, - required bool includeNameSpaceAsDeclaration, - required bool usePropertyAssignment, - }) { - final File buildGradle = package - .platformDirectory(FlutterPlatform.android) - .childDirectory('app') - .childFile('build.gradle'); - buildGradle.createSync(recursive: true); - - final namespace = - "${commentNamespace ? '// ' : ''}namespace ${includeNameSpaceAsDeclaration ? '= ' : ''}'$_defaultFakeNamespace'"; - buildGradle.writeAsStringSync(''' -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -apply plugin: 'com.android.application' -apply from: "\$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - ${includeNamespace ? namespace : ''} - compileSdk ${usePropertyAssignment ? '=' : ''} flutter.compileSdkVersion - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - applicationId "io.flutter.plugins.cameraexample" - minSdkVersion 21 - targetSdkVersion 28 - } -} - -flutter { - source '../..' +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "$kotlinVersion" apply false + ${includeArtifactHub ? 'id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.1"' : ''} } -dependencies { - testImplementation("fake.package:fake:1.0.0") -} +include ":app" '''); } - /// Writes a fake android/app/build.gradle file for an example [package] with - /// the given options. - void writeFakeKotlinExampleAppBuildGradle( + /// Writes a fake android/app/build.gradle.kts file for an example [package] + /// with the given options. + void writeFakeExampleAppBuildGradle( RepositoryPackage package, { required bool includeNamespace, required bool commentNamespace, @@ -541,64 +296,31 @@ flutter { '''); } - void writeFakeGroovyExampleBuildGradles( + void writeFakeExampleBuildGradles( RepositoryPackage package, { required String pluginName, - bool includeNamespace = true, - bool commentNamespace = false, - bool includeNameSpaceAsDeclaration = true, - bool warningsConfigured = true, String? kotlinVersion, - bool includeBuildArtifactHub = true, - bool includeSettingsArtifactHub = true, - bool includeSettingsDocumentationArtifactHub = true, - bool usePropertyAssignment = true, - }) { - writeFakeGroovyExampleTopLevelBuildGradle( - package, - pluginName: pluginName, - warningsConfigured: warningsConfigured, - kotlinVersion: kotlinVersion, - includeArtifactHub: includeBuildArtifactHub, - ); - writeFakeGroovyExampleAppBuildGradle( - package, - includeNamespace: includeNamespace, - commentNamespace: commentNamespace, - includeNameSpaceAsDeclaration: includeNameSpaceAsDeclaration, - usePropertyAssignment: usePropertyAssignment, - ); - writeFakeGroovyExampleSettingsGradle( - package, - includeArtifactHub: includeSettingsArtifactHub, - includeArtifactDocumentation: includeSettingsDocumentationArtifactHub, - ); - } - - void writeFakeKotlinExampleBuildGradles( - RepositoryPackage package, { - required String pluginName, bool includeNamespace = true, bool commentNamespace = false, - // TODO(stuartmorgan): Default to true once the test helper supports it. - bool warningsConfigured = false, + bool warningsConfigured = true, bool includeBuildArtifactHub = true, bool includeSettingsArtifactHub = true, bool includeSettingsDocumentationArtifactHub = true, }) { - writeFakeKotlinExampleTopLevelBuildGradle( + writeFakeExampleTopLevelBuildGradle( package, pluginName: pluginName, warningsConfigured: warningsConfigured, includeArtifactHub: includeBuildArtifactHub, ); - writeFakeKotlinExampleAppBuildGradle( + writeFakeExampleAppBuildGradle( package, includeNamespace: includeNamespace, commentNamespace: commentNamespace, ); - writeFakeKotlinExampleSettingsGradle( + writeFakeExampleSettingsGradle( package, + kotlinVersion: kotlinVersion ?? '2.2.20', includeArtifactHub: includeSettingsArtifactHub, includeArtifactDocumentation: includeSettingsDocumentationArtifactHub, ); @@ -640,14 +362,14 @@ flutter { }); test( - 'fails when build.gradle has no java compatibility version - groovy', + 'fails when build.gradle.kts has no java compatibility version', () async { final RepositoryPackage package = createFakePlugin( 'a_plugin', packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle(package); + writeFakePluginBuildGradle(package); writeFakeManifest(package); Error? commandError; @@ -662,39 +384,7 @@ flutter { expect(commandError, isA()); expect( output, - containsAllInOrder([ - contains(groovyJavaIncompatabilityIndicator), - ]), - ); - }, - ); - - test( - 'fails when build.gradle has no java compatibility version - kotlin', - () async { - final RepositoryPackage package = createFakePlugin( - 'a_plugin', - packagesDir, - examples: [], - ); - writeFakeKotlinPluginBuildGradle(package); - writeFakeManifest(package); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains(kotlinJavaIncompatabilityIndicator), - ]), + containsAllInOrder([contains(javaIncompatabilityIndicator)]), ); }, ); @@ -707,7 +397,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle(package, includeSourceCompat: true); + writeFakePluginBuildGradle(package, includeSourceCompat: true); writeFakeManifest(package); Error? commandError; @@ -722,9 +412,7 @@ flutter { expect(commandError, isA()); expect( output, - containsAllInOrder([ - contains(groovyJavaIncompatabilityIndicator), - ]), + containsAllInOrder([contains(javaIncompatabilityIndicator)]), ); }, ); @@ -737,7 +425,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeSourceCompat: true, includeTargetCompat: true, @@ -773,7 +461,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeSourceCompat: true, includeTargetCompat: true, @@ -797,7 +485,7 @@ flutter { output, containsAllInOrder([ contains( - 'If build.gradle uses JavaVersion.* versions must be the same.', + 'If build.gradle.kts uses JavaVersion.* versions must be the same.', ), ]), ); @@ -809,7 +497,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeSourceCompat: true, includeTargetCompat: true, @@ -825,7 +513,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); @@ -838,7 +526,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeSourceCompat: true, includeTargetCompat: true, @@ -852,7 +540,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }, @@ -864,7 +552,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); + writeFakePluginBuildGradle(package, includeLanguageVersion: true); writeFakeManifest(package); final List output = await runCapturingPrint(runner, [ @@ -874,40 +562,19 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); - test('does not require java version in examples - groovy', () async { + test('does not require java version in examples', () async { const pluginName = 'a_plugin'; - final RepositoryPackage package = createFakePlugin(pluginName, packagesDir); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: pluginName); - writeFakeManifest(example, isApp: true); - - final List output = await runCapturingPrint(runner, [ - 'gradle-check', - ]); - - expect( - output, - containsAllInOrder([ - contains('Validating android/build.gradle'), - contains('Ran for 2 package(s)'), - ]), + final RepositoryPackage package = createFakePackage( + pluginName, + packagesDir, ); - }); - - test('does not require java version in examples - kotlin', () async { - const pluginName = 'a_plugin'; - final RepositoryPackage package = createFakePlugin(pluginName, packagesDir); - writeFakeKotlinPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeKotlinExampleBuildGradles(example, pluginName: pluginName); + writeFakeExampleBuildGradles(example, pluginName: pluginName); writeFakeManifest(example, isApp: true); final List output = await runCapturingPrint(runner, [ @@ -918,7 +585,7 @@ flutter { output, containsAllInOrder([ contains('Validating android/build.gradle.kts'), - contains('Ran for 2 package(s)'), + contains('Ran for 1 package(s)'), ]), ); }); @@ -929,7 +596,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeSourceCompat: true, includeTargetCompat: true, @@ -949,9 +616,7 @@ flutter { expect(commandError, isA()); expect( output, - containsAllInOrder([ - contains(groovyJavaIncompatabilityIndicator), - ]), + containsAllInOrder([contains(javaIncompatabilityIndicator)]), ); }); @@ -961,7 +626,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, commentSourceLanguage: true, @@ -980,9 +645,7 @@ flutter { expect(commandError, isA()); expect( output, - containsAllInOrder([ - contains(groovyJavaIncompatabilityIndicator), - ]), + containsAllInOrder([contains(javaIncompatabilityIndicator)]), ); }); @@ -994,7 +657,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); + writeFakePluginBuildGradle(package, includeLanguageVersion: true); writeFakeManifest(package, packageName: 'wrong.package.name'); Error? commandError; @@ -1011,51 +674,20 @@ flutter { output, containsAllInOrder([ contains( - 'build.gradle "namespace" must match the "package" attribute in AndroidManifest.xml', + 'build.gradle.kts "namespace" must match the "package" attribute in AndroidManifest.xml', ), ]), ); }, ); - test('fails when namespace is missing - groovy', () async { + test('fails when namespace is missing', () async { final RepositoryPackage package = createFakePlugin( 'a_plugin', packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( - package, - includeLanguageVersion: true, - includeNamespace: false, - ); - 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 must set a "namespace"'), - ]), - ); - }); - - test('fails when namespace is missing - kotlin', () async { - final RepositoryPackage package = createFakePlugin( - 'a_plugin', - packagesDir, - examples: [], - ); - writeFakeKotlinPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, includeNamespace: false, @@ -1080,44 +712,13 @@ flutter { ); }); - test('fails when namespace is missing from example - groovy', () async { + test('fails when namespace is missing from example', () async { const pluginName = 'a_plugin'; final RepositoryPackage package = createFakePlugin(pluginName, packagesDir); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); + writeFakePluginBuildGradle(package, includeLanguageVersion: true); writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: pluginName, - includeNamespace: false, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains('build.gradle must set a "namespace"'), - ]), - ); - }); - - test('fails when namespace is missing from example - kotlin', () async { - const pluginName = 'a_plugin'; - final RepositoryPackage package = createFakePlugin(pluginName, packagesDir); - writeFakeKotlinPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); - final RepositoryPackage example = package.getExamples().first; - writeFakeKotlinExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: pluginName, includeNamespace: false, @@ -1154,10 +755,10 @@ flutter { pluginName, packagesDir, ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); + writeFakePluginBuildGradle(package, includeLanguageVersion: true); writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: pluginName); + writeFakeExampleBuildGradles(example, pluginName: pluginName); writeFakeManifest( example, isApp: true, @@ -1178,7 +779,7 @@ flutter { output, containsAllInOrder([ contains( - 'build.gradle "namespace" must match the "package" attribute in AndroidManifest.xml', + 'build.gradle.kts "namespace" must match the "package" attribute in AndroidManifest.xml', ), ]), ); @@ -1191,7 +792,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, commentNamespace: true, @@ -1211,39 +812,7 @@ flutter { expect( output, containsAllInOrder([ - contains('build.gradle must set a "namespace"'), - ]), - ); - }); - - test('fails when namespace is declared without "=" declaration', () async { - const pluginName = 'a_plugin'; - final RepositoryPackage package = createFakePlugin(pluginName, packagesDir); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: pluginName, - includeNameSpaceAsDeclaration: false, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains('build.gradle must set a "namespace"'), - contains('The following packages had errors:'), + contains('build.gradle.kts must set a "namespace"'), ]), ); }); @@ -1255,7 +824,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( plugin, includeLanguageVersion: true, warningsConfigured: false, @@ -1295,10 +864,10 @@ flutter { platformAndroid: const PlatformDetails(PlatformSupport.inline), }, ); - writeFakeGroovyPluginBuildGradle(plugin, includeLanguageVersion: true); + writeFakePluginBuildGradle(plugin, includeLanguageVersion: true); writeFakeManifest(plugin); final RepositoryPackage example = plugin.getExamples().first; - writeFakeGroovyExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: pluginName, warningsConfigured: false, @@ -1329,7 +898,7 @@ flutter { ); test( - 'passes if non-plugin package example javac lint-warnings-as-errors is missing - groovy', + 'passes if non-plugin package example javac lint-warnings-as-errors is missing', () async { const packageName = 'a_package'; final RepositoryPackage plugin = createFakePackage( @@ -1337,75 +906,10 @@ flutter { packagesDir, ); final RepositoryPackage example = plugin.getExamples().first; - writeFakeGroovyExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, - warningsConfigured: false, - ); - writeFakeManifest(example, isApp: true); - - final List output = await runCapturingPrint(runner, [ - 'gradle-check', - ]); - - expect( - output, - containsAllInOrder([ - contains('Validating android/build.gradle'), - ]), - ); - }, - ); - - test( - 'passes if non-plugin package example javac lint-warnings-as-errors is missing - kotlin', - () async { - const packageName = 'a_package'; - final RepositoryPackage plugin = createFakePackage( - packageName, - packagesDir, - ); - final RepositoryPackage example = plugin.getExamples().first; - writeFakeKotlinExampleBuildGradles( - example, - pluginName: packageName, - // TODO(stuartmorgan): Remove the ignore once the default flips. See - // the comment in writeFakeKotlinExampleBuildGradles. - // ignore: avoid_redundant_argument_values - warningsConfigured: false, - ); - writeFakeManifest(example, isApp: true); - - final List output = await runCapturingPrint(runner, [ - 'gradle-check', - ]); - - expect( - output, - containsAllInOrder([ - contains('Validating android/build.gradle.kts'), - ]), - ); - }, - ); - - group('Artifact Hub check', () { - test('passes build.gradle artifact hub check when set - groovy', () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - 'a_package', - packagesDir, - ); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: packageName, - // ignore: avoid_redundant_argument_values - includeBuildArtifactHub: true, - // ignore: avoid_redundant_argument_values - includeSettingsArtifactHub: true, - // ignore: avoid_redundant_argument_values - includeSettingsDocumentationArtifactHub: true, + warningsConfigured: false, ); writeFakeManifest(example, isApp: true); @@ -1416,20 +920,21 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), - contains('Validating android/settings.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); - }); + }, + ); - test('passes build.gradle artifact hub check when set - kotlin', () async { + group('Artifact Hub check', () { + test('passes build.gradle.kts artifact hub check when set', () async { const packageName = 'a_package'; final RepositoryPackage package = createFakePackage( 'a_package', packagesDir, ); final RepositoryPackage example = package.getExamples().first; - writeFakeKotlinExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, // ignore: avoid_redundant_argument_values @@ -1455,46 +960,7 @@ flutter { }); test( - 'fails artifact hub check when build and settings sections missing - groovy', - () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - 'a_package', - packagesDir, - ); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: packageName, - includeBuildArtifactHub: false, - includeSettingsArtifactHub: false, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains( - GradleCheckCommand.exampleGroovyRootGradleArtifactHubString, - ), - contains(GradleCheckCommand.exampleGroovySettingsArtifactHubString), - ]), - ); - }, - ); - - test( - 'fails artifact hub check when build and settings sections missing - kotlin', + 'fails artifact hub check when build and settings sections missing', () async { const packageName = 'a_package'; final RepositoryPackage package = createFakePackage( @@ -1502,7 +968,7 @@ flutter { packagesDir, ); final RepositoryPackage example = package.getExamples().first; - writeFakeKotlinExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, includeBuildArtifactHub: false, @@ -1523,49 +989,13 @@ flutter { expect( output, containsAllInOrder([ - contains( - GradleCheckCommand.exampleKotlinRootGradleArtifactHubString, - ), - contains(GradleCheckCommand.exampleKotlinSettingsArtifactHubString), + contains(GradleCheckCommand.exampleRootGradleArtifactHubString), + contains(GradleCheckCommand.exampleSettingsArtifactHubString), ]), ); }, ); - test('fails build.gradle artifact hub check when missing', () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - 'a_package', - packagesDir, - ); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: packageName, - includeBuildArtifactHub: false, - // ignore: avoid_redundant_argument_values - includeSettingsArtifactHub: true, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains(GradleCheckCommand.exampleGroovyRootGradleArtifactHubString), - ]), - ); - }); - test('fails build.gradle.kts artifact hub check when missing', () async { const packageName = 'a_package'; final RepositoryPackage package = createFakePackage( @@ -1573,7 +1003,7 @@ flutter { packagesDir, ); final RepositoryPackage example = package.getExamples().first; - writeFakeKotlinExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, includeBuildArtifactHub: false, @@ -1595,49 +1025,9 @@ flutter { expect( output, containsAllInOrder([ - contains(GradleCheckCommand.exampleKotlinRootGradleArtifactHubString), - ]), - ); - }); - - test('fails settings.gradle artifact hub check when missing', () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - 'a_package', - packagesDir, - ); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: packageName, - // ignore: avoid_redundant_argument_values - includeBuildArtifactHub: true, - includeSettingsArtifactHub: false, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains(GradleCheckCommand.exampleGroovySettingsArtifactHubString), + contains(GradleCheckCommand.exampleRootGradleArtifactHubString), ]), ); - expect( - output, - isNot( - contains(GradleCheckCommand.exampleGroovyRootGradleArtifactHubString), - ), - ); }); test('fails settings.gradle.kts artifact hub check when missing', () async { @@ -1647,7 +1037,7 @@ flutter { packagesDir, ); final RepositoryPackage example = package.getExamples().first; - writeFakeKotlinExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, // ignore: avoid_redundant_argument_values @@ -1669,99 +1059,17 @@ flutter { expect( output, containsAllInOrder([ - contains(GradleCheckCommand.exampleKotlinSettingsArtifactHubString), + contains(GradleCheckCommand.exampleSettingsArtifactHubString), ]), ); expect( output, - isNot( - contains(GradleCheckCommand.exampleKotlinRootGradleArtifactHubString), - ), + isNot(contains(GradleCheckCommand.exampleRootGradleArtifactHubString)), ); }); test( - 'prints error for declarative method of applying gradle plugins', - () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - 'a_package', - packagesDir, - ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: packageName, - // ignore: avoid_redundant_argument_values - includeBuildArtifactHub: true, - includeSettingsArtifactHub: false, - // ignore: avoid_redundant_argument_values - includeSettingsDocumentationArtifactHub: true, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains(GradleCheckCommand.exampleGroovySettingsArtifactHubString), - ]), - ); - }, - ); - - test( - 'error message is printed when documentation link is missing - groovy', - () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - 'a_package', - packagesDir, - ); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: packageName, - // ignore: avoid_redundant_argument_values - includeBuildArtifactHub: true, - // ignore: avoid_redundant_argument_values - includeSettingsArtifactHub: true, - includeSettingsDocumentationArtifactHub: false, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains(GradleCheckCommand.artifactHubDocumentationString), - ]), - ); - }, - ); - - test( - 'error message is printed when documentation link is missing - kotlin', + 'error message is printed when documentation link is missing', () async { const packageName = 'a_package'; final RepositoryPackage package = createFakePackage( @@ -1769,7 +1077,7 @@ flutter { packagesDir, ); final RepositoryPackage example = package.getExamples().first; - writeFakeKotlinExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, // ignore: avoid_redundant_argument_values @@ -1807,10 +1115,8 @@ flutter { 'a_package', packagesDir, ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: packageName); + writeFakeExampleBuildGradles(example, pluginName: packageName); writeFakeManifest(example, isApp: true); final List output = await runCapturingPrint(runner, [ @@ -1820,7 +1126,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); @@ -1831,10 +1137,8 @@ flutter { 'a_package', packagesDir, ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, kotlinVersion: minKotlinVersion.toString(), @@ -1848,7 +1152,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); @@ -1859,10 +1163,8 @@ flutter { 'a_package', packagesDir, ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, kotlinVersion: '99.99.0', @@ -1876,7 +1178,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); @@ -1887,10 +1189,8 @@ flutter { 'a_package', packagesDir, ); - writeFakeGroovyPluginBuildGradle(package, includeLanguageVersion: true); - writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( + writeFakeExampleBuildGradles( example, pluginName: packageName, kotlinVersion: '1.6.21', @@ -1911,9 +1211,10 @@ flutter { output, containsAllInOrder([ contains( - 'build.gradle sets "ext.kotlin_version" to "1.6.21". The ' - 'minimum Kotlin version that can be specified is ' - '$minKotlinVersion, for compatibility with modern dependencies.', + 'settings.gradle.kts sets the "org.jetbrains.kotlin.android" plugin ' + 'version to "1.6.21". The minimum Kotlin version that can be ' + 'specified is $minKotlinVersion, for compatibility with modern ' + 'dependencies.', ), ]), ); @@ -1931,14 +1232,14 @@ flutter { isFlutter: true, ); // Current flutter.compileSdkVersion is 36. - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, compileSdk: '37', ); writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: packageName); + writeFakeExampleBuildGradles(example, pluginName: packageName); writeFakeManifest(example, isApp: true); final List output = await runCapturingPrint(runner, [ @@ -1948,7 +1249,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }, @@ -1964,14 +1265,14 @@ flutter { isFlutter: true, flutterConstraint: '>=3.27.0', ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, compileSdk: 'flutter.compileSdkVersion', ); writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: packageName); + writeFakeExampleBuildGradles(example, pluginName: packageName); writeFakeManifest(example, isApp: true); final List output = await runCapturingPrint(runner, [ @@ -1981,7 +1282,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }, @@ -1999,14 +1300,14 @@ flutter { // Current flutter.compileSdkVersion is 36. const minCompileSdkVersion = '36'; const testCompileSdkVersion = '35'; - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, compileSdk: testCompileSdkVersion, ); writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: packageName); + writeFakeExampleBuildGradles(example, pluginName: packageName); writeFakeManifest(example, isApp: true); Error? commandError; @@ -2041,14 +1342,14 @@ flutter { isFlutter: true, flutterConstraint: '>=3.24.0', ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, compileSdk: 'flutter.compileSdkVersion', ); writeFakeManifest(package); final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: packageName); + writeFakeExampleBuildGradles(example, pluginName: packageName); writeFakeManifest(example, isApp: true); Error? commandError; @@ -2073,83 +1374,6 @@ flutter { ); }, ); - - test('fails if uses the legacy key', () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - packageName, - packagesDir, - isFlutter: true, - ); - writeFakeGroovyPluginBuildGradle( - package, - includeLanguageVersion: true, - useDeprecatedCompileSdkVersion: true, - ); - writeFakeManifest(package); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles(example, pluginName: packageName); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains( - 'Please replace the deprecated "compileSdkVersion" setting ' - 'with the newer "compileSdk"', - ), - ]), - ); - }); - - test('fails if compileSdk uses the method assignment', () async { - const packageName = 'a_package'; - final RepositoryPackage package = createFakePackage( - packageName, - packagesDir, - isFlutter: true, - ); - writeFakeGroovyPluginBuildGradle( - package, - includeLanguageVersion: true, - usePropertyAssignment: false, - ); - writeFakeManifest(package); - final RepositoryPackage example = package.getExamples().first; - writeFakeGroovyExampleBuildGradles( - example, - pluginName: packageName, - usePropertyAssignment: false, - ); - writeFakeManifest(example, isApp: true); - - Error? commandError; - final List output = await runCapturingPrint( - runner, - ['gradle-check'], - errorHandler: (Error e) { - commandError = e; - }, - ); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains('No "compileSdk =" found. Please use property assignment.'), - ]), - ); - }); }); group('kotlinOptions check', () { @@ -2159,7 +1383,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, // ignore: avoid_redundant_argument_values ensure codepath is tested if defaults change. @@ -2174,7 +1398,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); @@ -2185,7 +1409,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, includeKotlinOptions: false, @@ -2199,7 +1423,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); @@ -2210,7 +1434,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, commentKotlinOptions: true, @@ -2224,7 +1448,7 @@ flutter { expect( output, containsAllInOrder([ - contains('Validating android/build.gradle'), + contains('Validating android/build.gradle.kts'), ]), ); }); @@ -2235,7 +1459,7 @@ flutter { packagesDir, examples: [], ); - writeFakeGroovyPluginBuildGradle( + writeFakePluginBuildGradle( package, includeLanguageVersion: true, useDeprecatedJvmTargetStyle: true, @@ -2256,7 +1480,7 @@ flutter { output, containsAllInOrder([ contains( - 'build.gradle sets jvmTarget then it must use JavaVersion syntax', + 'build.gradle.kts sets jvmTarget then it must use JavaVersion syntax', ), ]), ); diff --git a/script/tool/test/update_excerpts_command_test.dart b/script/tool/test/update_excerpts_command_test.dart index b98e9329392c..314d940e5eaf 100644 --- a/script/tool/test/update_excerpts_command_test.dart +++ b/script/tool/test/update_excerpts_command_test.dart @@ -545,6 +545,7 @@ FAIL {'filename': 'main.dart'}, {'filename': 'main.js'}, {'filename': 'main.kt', 'language': 'kotlin'}, + {'filename': 'main.kts', 'language': 'kotlin'}, {'filename': 'main.java'}, {'filename': 'main.gradle', 'language': 'groovy'}, {'filename': 'main.m', 'language': 'objectivec'}, diff --git a/script/tool/test/version_check_command_test.dart b/script/tool/test/version_check_command_test.dart index f5de2c2c02eb..ee37a55313ca 100644 --- a/script/tool/test/version_check_command_test.dart +++ b/script/tool/test/version_check_command_test.dart @@ -2079,7 +2079,7 @@ release: }, ); test( - 'ignores changelog and pubspec yaml version modifications check with post-release label', + 'ignores changelog and pubspec yaml version modifications check with override: post-release label', () async { final RepositoryPackage package = createFakePackage( 'package', @@ -2112,7 +2112,7 @@ packages/package/pubspec.yaml final List output = await runCapturingPrint(runner, [ 'version-check', '--base-sha=main', - '--pr-labels=post-release-package', + '--pr-labels=override: post-release-package', ]); expect( diff --git a/third_party/packages/flutter_svg/example/linux/flutter/generated_plugins.cmake b/third_party/packages/flutter_svg/example/linux/flutter/generated_plugins.cmake deleted file mode 100644 index 2e1de87a7eb6..000000000000 --- a/third_party/packages/flutter_svg/example/linux/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/third_party/packages/flutter_svg/example/windows/flutter/generated_plugins.cmake b/third_party/packages/flutter_svg/example/windows/flutter/generated_plugins.cmake deleted file mode 100644 index b93c4c30c167..000000000000 --- a/third_party/packages/flutter_svg/example/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin)