Add to app measurement (#33458)
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index 60c8f12..46cec9b 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart
@@ -397,6 +397,7 @@ final FlutterProject parent; static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s+[\'\"](.*)[\'\"]\\s*\$'); + static final RegExp _kotlinPluginPattern = RegExp('^\\s*apply plugin\:\\s+[\'\"]kotlin-android[\'\"]\\s*\$'); static final RegExp _groupPattern = RegExp('^\\s*group\\s+[\'\"](.*)[\'\"]\\s*\$'); /// The Gradle root directory of the Android host app. This is the directory @@ -419,6 +420,12 @@ /// True if the parent Flutter project is a module. bool get isModule => parent.isModule; + /// True, if the app project is using Kotlin. + bool get isKotlin { + final File gradleFile = hostAppGradleRoot.childDirectory('app').childFile('build.gradle'); + return _firstMatchInFile(gradleFile, _kotlinPluginPattern) != null; + } + File get appManifestFile { return isUsingGradle ? fs.file(fs.path.join(hostAppGradleRoot.path, 'app', 'src', 'main', 'AndroidManifest.xml'))