setAppName method
Sets the app name in the macOS AppInfo.xcconfig file.
Parameters:
appName
: The new app name to be set for the application.
Returns: Future<String?>, a success message indicating the change in app name.
Implementation
@override
Future<String?> setAppName({required String appName}) async {
final filePath = macosAppInfoxprojPath;
List? contentLineByLine = await readFileAsLineByline(
filePath: filePath,
);
for (var i = 0; i < contentLineByLine.length; i++) {
if (contentLineByLine[i].contains('PRODUCT_NAME')) {
contentLineByLine[i] = 'PRODUCT_NAME = $appName';
break;
}
}
final message = await super.setAppName(appName: appName);
await writeFile(
filePath: filePath,
content: contentLineByLine.join('\n'),
);
return message;
}