FlutterExtension: make fields non-static (#141463)
There's no issue for this PR. I can create one if requested. ## Summary This PR makes public fields of `FlutterExtension` non-static. The aim is to make migrating from Gradle Groovy DSL to Gradle Kotlin DSL easier for Flutter developers, because... ### Without this PR **android/app/build.gradle.kts** ```kotlin plugins { id "com.android.application" id "dev.flutter.flutter-gradle-plugin" } android { namespace = "io.flutter.examples.hello_world" compileSdk = FlutterExtension.compileSdkVersion defaultConfig { applicationId = "io.flutter.examples.hello_world" minSdk = FlutterExtension.minSdkVersion targetSdk = FlutterExtension.targetSdkVersion // ... } } // ... ``` Groovy and Java allow accessing static fields of a class through its instance, but Kotlin is being more "correct" and disallows that. ### With this PR Thanks to this PR, the user won't have to replace `flutter` with FlutterExtension in some places, thus decreasing possible confusion. ```kotlin plugins { id "com.android.application" id "dev.flutter.flutter-gradle-plugin" } android { namespace = "io.flutter.examples.hello_world" compileSdk = flutter.compileSdkVersion defaultConfig { applicationId = "io.flutter.examples.hello_world" minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion // ... } } // ... ```
This commit is contained in:
parent
4b914bd17c
commit
dbf5f04b86
@ -41,10 +41,10 @@ import org.gradle.internal.os.OperatingSystem
|
||||
*/
|
||||
class FlutterExtension {
|
||||
/** Sets the compileSdkVersion used by default in Flutter app projects. */
|
||||
static int compileSdkVersion = 34
|
||||
final int compileSdkVersion = 34
|
||||
|
||||
/** Sets the minSdkVersion used by default in Flutter app projects. */
|
||||
static int minSdkVersion = 19
|
||||
final int minSdkVersion = 19
|
||||
|
||||
/**
|
||||
* Sets the targetSdkVersion used by default in Flutter app projects.
|
||||
@ -52,14 +52,14 @@ class FlutterExtension {
|
||||
*
|
||||
* See https://developer.android.com/guide/topics/manifest/uses-sdk-element.
|
||||
*/
|
||||
static int targetSdkVersion = 33
|
||||
final int targetSdkVersion = 33
|
||||
|
||||
/**
|
||||
* Sets the ndkVersion used by default in Flutter app projects.
|
||||
* Chosen as default version of the AGP version below as found in
|
||||
* https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp.
|
||||
*/
|
||||
static String ndkVersion = "23.1.7779620"
|
||||
final String ndkVersion = "23.1.7779620"
|
||||
|
||||
/**
|
||||
* Specifies the relative directory to the Flutter project directory.
|
||||
|
Loading…
x
Reference in New Issue
Block a user