• Bartek Pacia's avatar
    FlutterExtension: make fields non-static (#141463) · dbf5f04b
    Bartek Pacia authored
    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
            // ...
        }
    }
    // ...
    ```
    dbf5f04b
flutter.groovy 75.1 KB