GradleEditor class

Inserts a flavorDimensions + productFlavors block into a Flutter- generated Android app gradle file. Handles both the Kotlin DSL (build.gradle.kts) and the legacy Groovy DSL (build.gradle).

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

apply(ProjectConfig config) → void
Edits android/app/build.gradle{.kts} in config's project to add the product flavors. No-op (with a warning) when there are no flavors, no gradle file (e.g. flutter create was skipped), or the block already exists. Throws StateError if the file exists but has no android { } block to edit.
applyManifest(ProjectConfig config) → void
Rewrites android/app/src/main/AndroidManifest.xml so the app label reads from the per-flavor app_name string resource (defined via resValue in apply) instead of a hard-coded value. Without this, the resValue entries are inert and every flavor shows the same name.
injectProductFlavors(String content, {required bool isKts, required List<FlavorGradle> flavors}) String
Pure transform: returns content with the flavors block inserted just before the closing brace of the android { } block. Exposed for testing.
setAppLabelToResource(String manifest) String
Pure transform: replaces the android:label="..." attribute value with @string/app_name. Exposed for testing. Throws StateError when the attribute is absent. Idempotent — re-running on an already-wired manifest returns it unchanged.