changeMacOsBundleId method
Implementation
Future<File?> changeMacOsBundleId({String? bundleId}) async {
List? contentLineByLine = await readFileAsLineByline(
filePath: macosAppInfoxprojPath,
);
if (checkFileExists(contentLineByLine)) {
logger.w('''
macOS BundleId 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_BUNDLE_IDENTIFIER')) {
contentLineByLine[i] = 'PRODUCT_BUNDLE_IDENTIFIER = $bundleId;';
}
}
var writtenFile = await writeFile(
filePath: macosAppInfoxprojPath,
content: contentLineByLine.join('\n'),
);
logger.i('MacOS BundleIdentifier changed successfully to : $bundleId');
return writtenFile;
}