getBundleName function

String? getBundleName({
  1. Platform platform = Platform.ios,
})

Implementation

String? getBundleName({Platform platform = Platform.ios}) {
  String? bundlePath;
  switch (platform) {
    case Platform.ios:
      bundlePath = 'ios/Runner/Info.plist';
      if (!File(bundlePath).existsSync()) {
        bundlePath = 'ios/Runner/Info-Debug.plist';
      }
      break;
    default:
      throw PlatformNotImplementedException(platform);
  }
  if (!isPathExists(bundlePath)) {
    throw PathDoesNotExistsException(bundlePath);
  }
  switch (platform) {
    case Platform.ios:
      return _getIOSBundleName(bundlePath);
    default:
      throw PlatformNotImplementedException(platform);
  }
}