minSdk function
Retrieves the minSdk value for the project rooted at prefixPath.
Probes, in order:
- App-level gradle file via findAndroidGradleFile (KTS preferred over
Groovy). Tries multiple
minSdkregex patterns appropriate for the detected DSL. - If a
flutter.minSdkVersionindirection is detected, recurses into the Flutter SDK gradle file located viaflutter.sdkinlocal.properties. - Falls back to a
flutter.minSdkVersion=...line inlocal.properties.
Returns null when none of the probes yield a value (caller falls back to
constants.androidDefaultAndroidMinSDK).
Known limitations (return null → user must specify min_sdk_android):
- Version catalogs (
libs.versions.tomlreferences likelibs.versions.minSdk.get().toInt()). - Convention plugin delegation.
Implementation
Future<int?> minSdk({String prefixPath = '.'}) async {
final detection = await detectMinSdkAndroid(prefixPath: prefixPath);
return detection.value;
}