changeMacOsAppName method
Implementation
Future<File?> changeMacOsAppName(String? appName) async {
List? contentLineByLine = await readFileAsLineByline(
filePath: macosAppInfoxprojPath,
);
if (checkFileExists(contentLineByLine)) {
logger.w('''
macOS AppName could not be changed because,
The related file could not be found in that path: $macosAppInfoxprojPath
''');
return null;
}
for (var i = 0; i < contentLineByLine!.length; i++) {
if (contentLineByLine[i].contains('PRODUCT_NAME')) {
contentLineByLine[i] = 'PRODUCT_NAME = $appName;';
break;
}
}
var writtenFile = await writeFile(
filePath: macosAppInfoxprojPath,
content: contentLineByLine.join('\n'),
);
logger.i('MacOS appname changed successfully to : $appName');
return writtenFile;
}