• 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
Name
Last commit
Last update
.github Loading commit data...
.vscode Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...