copy method

  1. @override
Future<bool> copy(
  1. String fromPath,
  2. String toPath,
  3. ContentHash expectedHash
)

Copies the file at fromPath to toPath within this source, reusing the bytes already present — but only after verifying that fromPath still hashes to expectedHash.

Returns true when the source was verified and copied. Returns false when fromPath is missing or its current hash no longer matches expectedHash; the caller must then fall back to a normal byte transfer. This guards the time-of-check/time-of-use gap between manifest build and copy execution. Only meaningful when supportsCopy resolves true.

When executable is true the copied file is marked executable at the destination, matching a normal writeBytes.

Implementation

@override
Future<bool> copy(String fromPath, String toPath, ContentHash expectedHash) =>
    _rpc.copy(fromPath, toPath, expectedHash.value);