Skip to content

Migrate to built in kotlin for flutter 3.44#49

Open
kjeremy wants to merge 1 commit into
bdlukaa:masterfrom
kjeremy:flutter-3.44
Open

Migrate to built in kotlin for flutter 3.44#49
kjeremy wants to merge 1 commit into
bdlukaa:masterfrom
kjeremy:flutter-3.44

Conversation

@kjeremy
Copy link
Copy Markdown

@kjeremy kjeremy commented May 20, 2026

This allows the plugin to be consumed by projects using android/ generated by flutter 3.44

see: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin

Includes the fix from #48

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the project to built-in Kotlin support, updates Android build configurations to target SDK 34, and refines Windows CMake scripts. Feedback highlights critical issues: the kotlin-android plugin and its classpath dependency were incorrectly removed from the plugin's build.gradle, which will break the build. Additionally, the pubspec.yaml files contain non-existent Dart and Flutter versions, and the gradle.properties flags for built-in Kotlin are currently disabled. Upgrading the outdated Android Gradle Plugin is also recommended.


apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

For a Flutter plugin containing Kotlin source code, the kotlin-android plugin must still be applied in the plugin's build.gradle file. While the "built-in Kotlin" migration simplifies configuration for the main application, plugin modules still require the Kotlin plugin to compile their source files. Removing this will result in the Kotlin code in src/main/kotlin being ignored during the build.

apply plugin: 'kotlin-android'

Comment on lines +9 to +10
sdk: ^3.12.0
flutter: ">=3.44.0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The environment constraints sdk: ^3.12.0 and flutter: ">=3.44.0" appear to be incorrect as these versions have not been released (current stable versions are Dart 3.5 and Flutter 3.24). These settings will prevent the package from being resolved by users. If you intended to target the versions that introduced built-in Kotlin support, you likely meant sdk: ^3.5.0 and flutter: ">=3.24.0".

  sdk: ^3.5.0
  flutter: ">=3.24.0"

Comment thread system_theme/pubspec.yaml
Comment on lines +8 to +9
sdk: ^3.12.0
flutter: ">=3.44.0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The SDK and Flutter constraints specified here (sdk: ^3.12.0 and flutter: ">=3.44.0") refer to versions that do not yet exist in the stable channel. This will make the plugin unusable for all current Flutter users. Please verify and correct these versions to match the intended target (likely Flutter 3.24.0 and its corresponding Dart SDK).

  sdk: ^3.5.0
  flutter: ">=3.24.0"

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The Kotlin Gradle plugin was removed from the buildscript classpath, but the kotlin configuration block at the end of this file (line 40) relies on classes provided by this plugin (specifically org.jetbrains.kotlin.gradle.dsl.JvmTarget). This will cause a build failure during Gradle evaluation. You should retain the Kotlin plugin in the buildscript dependencies.

        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24"
    }

Comment on lines +3 to +6
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=false
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=false
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The PR title indicates a migration to built-in Kotlin support, but the flags android.builtInKotlin and android.newDsl are set to false. To actually enable the built-in Kotlin feature introduced in Flutter 3.24, these flags must be set to true.

# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=true
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=true

}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Android Gradle Plugin (AGP) version 4.1.0 is significantly outdated and may not be fully compatible with compileSdkVersion 34 or the modern Kotlin DSL features used later in this file. It is recommended to upgrade to a more recent version (e.g., 7.4.2 or 8.x) to ensure stability and compatibility with current Android build tools.

@kjeremy
Copy link
Copy Markdown
Author

kjeremy commented May 20, 2026

I think gemini code assist is showing outdated information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant