AndroidManager class final

Manages Android-specific native configurations for Flutter projects.

This class provides methods to:

  • Update the minSdkVersion in Gradle build files
  • Add/remove permissions to AndroidManifest.xml
  • Add uses-feature tags to AndroidManifest.xml
  • Get current configuration status

Usage

final manager = AndroidManager('/path/to/flutter/project');

// Update minSdkVersion
final result = manager.updateMinSdk(23);

// Add a permission
final permResult = manager.addPermission('android.permission.CAMERA');

// Remove a permission
final removeResult = manager.removePermission('android.permission.CAMERA');

// Add a feature
final featureResult = manager.addFeature('android.hardware.camera', required: true);

File Locations

The manager looks for files in these standard Flutter project locations:

  • android/app/build.gradle (Groovy DSL)
  • android/app/build.gradle.kts (Kotlin DSL)
  • android/app/src/main/AndroidManifest.xml

Constructors

AndroidManager(String projectRoot)
Creates a new AndroidManager for the Flutter project at projectRoot.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isAndroidProjectPresent bool
Returns true if the android/ directory exists in the project.
no setter
projectRoot String
The root directory of the Flutter project.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addFeature(String featureName, {bool required = true}) OperationResult
Adds a uses-feature tag to the AndroidManifest.xml file.
addPermission(String permissionName) OperationResult
Adds a permission to the AndroidManifest.xml file.
getFeatures() List<Map<String, dynamic>>
Gets the list of features currently in AndroidManifest.xml.
getMinSdkVersion() int?
Gets the current minSdkVersion from the build.gradle file.
getPermissions() List<String>
Gets the list of permissions currently in AndroidManifest.xml.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removePermission(String permissionName) OperationResult
Removes a permission from the AndroidManifest.xml file.
toString() String
A string representation of this object.
inherited
updateMinSdk(int version) OperationResult
Updates the minSdkVersion in the Android Gradle build file.

Operators

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