changeWindowsCppName method
Implementation
Future<void> changeWindowsCppName(String? appName) async {
List? contentLineByLine = await readFileAsLineByline(
filePath: windowsAppPath,
);
if (checkFileExists(contentLineByLine)) {
logger.w('''
Windows appname could not be changed because,
The related file could not be found in that path: $windowsAppPath
''');
return null;
}
for (var i = 0; i < contentLineByLine!.length; i++) {
if (contentLineByLine[i].contains('window.CreateAndShow')) {
contentLineByLine[i] =
contentLineByLine[i].replaceAllMapped(RegExp(r'CreateAndShow\(L"([^"]+")'), (match) { return 'CreateAndShow(L"$appName"'; });
break;
}
}
await writeFile(
filePath: windowsAppPath,
content: contentLineByLine.join('\n'),
);
}