getAppName method

  1. @override
Future<String?> getAppName()
override

Fetches the app name from the macOS AppInfo.xcconfig file.

Returns: Future<String?>, the app name if found, null otherwise.

Implementation

@override
Future<String?> getAppName() async {
  final filePath = macosAppInfoxprojPath;
  var contentLineByLine = await readFileAsLineByline(
    filePath: filePath,
  );
  for (var i = 0; i < contentLineByLine.length; i++) {
    if (contentLineByLine[i]?.contains('PRODUCT_NAME') ?? false) {
      return (contentLineByLine[i] as String).split('=').last.trim();
    }
  }
  return null;
}