editFileContent static method
void
editFileContent(})
Implementation
static void editFileContent(String path, String newContent,
{bool canFormated = true, bool showLog = true}) {
final file = File(path);
if (file.existsSync()) {
file.writeAsStringSync(canFormated
? DartFormatter(languageVersion: DartFormatter.latestLanguageVersion)
.format(newContent)
: newContent);
if (showLog) {
stdout.write(
'${ColorsText.green} ✓${ColorsText.reset} Updated file: ${ColorsText.cyan}$path${ColorsText.reset}\n');
}
} else {
createFileWithContent(path, newContent);
}
}