manifestManipulation function
Implementation
void manifestManipulation({required ExtensionDetails extensionDetails}) {
try {
FileManipulation manifestJson = FileManipulation();
//SETTING THE FILE PATH
manifestJson.setFilePath(filePath: "web", fileName: "manifest.json");
//COPYING THE CONSTANTS MANIFEST CONFIG TO A NEW MAP
//SO THAT WE CAN CHANGE THE VALUES ACCORDING TO THE USER INPUT
Map<String, dynamic> manifestConfig = manifestDefaultConfig;
manifestConfig['name'] = extensionDetails.name;
manifestConfig['description'] = extensionDetails.description;
manifestConfig['version'] = extensionDetails.version;
//CONVERTING THE MANIFEST_DEFAULT_CONFIG TO STRING WITH INDENTATION
String configManifest =
JsonEncoder.withIndent(' ').convert(manifestDefaultConfig);
//REPLACE THE MANIFEST FILE WITH THE NEW CONFIG
manifestJson.writeToFile(configManifest);
} on FileSystemException catch (e) {
//IF THE FILE IS NOT FOUND
getErrorForFileNotFound();
Logger.error("❌ ${e.toString()}");
exit(1);
} catch (e) {
Logger.error("❌ ${e.toString()}");
}
}