makeConfig static method
dynamic
makeConfig(})
Creates a new config file.
Implementation
static makeConfig(String configName, String value,
{String folderPath = configFolder,
bool forceCreate = false,
String? creationPath}) async {
String name = configName.replaceAll(RegExp(r'(_?config)'), "");
// create missing directories in the project
await _makeDirectory(folderPath);
await createDirectoriesFromCreationPath(creationPath, folderPath);
// create file path
String filePath = createPathForDartFile(
folderPath: folderPath, className: name, creationPath: creationPath);
await _checkIfFileExists(filePath, shouldForceCreate: forceCreate);
await _createNewFile(filePath, value, onSuccess: () {
MetroConsole.writeInGreen('[Config] ${name.snakeCase} created 🎉');
});
}