createFile function

void createFile(
  1. String filePath,
  2. String content
)

Writes content to a new file at filePath. If the file already exists, logs a warning and leaves it untouched instead of overwriting it.

Implementation

void createFile(String filePath, String content) {
  final file = File(filePath);
  if (!file.existsSync()) {
    file.writeAsStringSync(content);
  } else {
    ConsoleLogger.warning('File already exists: $filePath (Skipping)');
  }
}