getAppName method
Fetches the app name from the iOS Info.plist file.
Returns: Future<String?>, the app name if found, null otherwise.
Implementation
@override
Future<String?> getAppName() async {
final filePath = iosInfoPlistPath;
var contentLineByLine = await readFileAsLineByline(
filePath: filePath,
);
for (var i = 0; i < contentLineByLine.length; i++) {
if (contentLineByLine[i]?.contains('<key>CFBundleName</key>') ?? false) {
var match = RegExp(r'<string>(.*?)</string>')
.firstMatch(contentLineByLine[i + 1]!);
return match?.group(1)?.trim();
}
}
return null;
}