writeIfAbsent method

Future<void> writeIfAbsent(
  1. String relativePath,
  2. String contents
)

Never overwrites; creates only when missing.

Implementation

Future<void> writeIfAbsent(String relativePath, String contents) async {
  final file = File(p.join(writer.root, relativePath));
  if (await file.exists()) {
    writer.skipped.add(relativePath);
    preserved.add(relativePath);
    return;
  }
  await writer.write(relativePath, contents, force: true);
}