createFile method

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

Create a file with content

Implementation

void createFile(String relativePath, String content) {
  try {
    final fullPath = DirectoryService.replaceAsExpected(
      path: '$basePath/$relativePath',
    );
    final file = File(fullPath);
    file.createSync(recursive: true);
    file.writeAsStringSync(content);
    LogService.success('Created $relativePath');
  } on FileSystemException catch (err) {
    LogService.error('${err.message} -> $relativePath');
  }
}