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