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