writeFile static method

void writeFile(
  1. String path,
  2. String content
)

Function that writes file to the disk

path has to be a fully qualified path content is the raw file contents as string

Implementation

static void writeFile(
  String path,
  String content,
) {
  try {
    final _file = File(DirectoryService.replaceAsExpected(path: path));
    _file.createSync(recursive: true);
    _file.writeAsStringSync(content);
    LogService.success('Created $path');
  } on FileSystemException catch (err) {
    LogService.error('${err.message} -> ${'$path'}');
  }
}