move method

  1. @override
Future<void> move(
  1. String from,
  2. String to
)
override

Renames, rather than copying and deleting.

Two things the base class's default cannot give: the move is atomic, so an interruption leaves the file at exactly one path; and it never reads the bytes, so retiring a asset into .history/.assets/ does not pull tens of megabytes through memory to move a file a few inches.

Expected-green under mutation: copy-and-delete reaches the same end state, so no outcome-based test can tell them apart. Both properties this buys are invisible from the outside — one needs an interruption, the other a memory measurement — which is the same reason the fsync and the unique temp name below are expected-green. Kept because the cost is one line and the failures are silent.

Implementation

@override
Future<void> move(String from, String to) async {
  final target = _file(to);
  target.parent.createSync(recursive: true);
  _file(from).renameSync(target.path);
}