projectBundleId function

String? projectBundleId(
  1. String projectDir
)

The project's bundle identifier, if the Runner target names one.

Implementation

String? projectBundleId(String projectDir) {
  final pbx = File('$projectDir/ios/Runner.xcodeproj/project.pbxproj');
  if (!pbx.existsSync()) return null;
  return RegExp(r'PRODUCT_BUNDLE_IDENTIFIER = ([^;]+);')
      .allMatches(pbx.readAsStringSync())
      .map((m) => m.group(1)!)
      .where((id) => !id.contains('Tests'))
      .firstOrNull;
}