appInfoForProject method

Future<(String?, String?)?> appInfoForProject(
  1. String projectDir
)

(CFBundleIdentifier, display name) from the app flutter built for projectDir. Tied to the exact project behind our VM (projectDirForVm), so it can't grab a different app that also ran on the device. Null when no built product exists (e.g. attached to an app we didn't build here).

Implementation

Future<(String?, String?)?> appInfoForProject(String projectDir) async {
  for (final variant in const ['iphonesimulator', 'iphoneos']) {
    final appDir = '$projectDir/build/ios/$variant/Runner.app';
    if (!File('$appDir/Info.plist').existsSync()) continue;
    final info = await _readBundleInfo(appDir);
    if (info != null && info.$1 != null) return info;
  }
  return null;
}