createFile function

bool createFile(
  1. String path,
  2. String content
)

Creates a file at path and writes content to it.

Existing files are never overwritten. Returns true if the file was created, or false if it already existed (a skip is logged in that case).

Implementation

bool createFile(String path, String content) {
  final file = File(path);

  if (file.existsSync()) {
    logSkip(path);
    return false;
  }

  file.createSync(recursive: true);
  file.writeAsStringSync(content);
  logCreate(path);
  return true;
}