truncate method
Resizes the container to newLength bytes (shrinking discards tail
bytes).
Implementation
@override
Future<void> truncate(int newLength) async {
RangeError.checkNotNegative(newLength, 'newLength');
if (readOnly) {
throw const WalPackReadOnlyException();
}
final raf = _requireOpen();
try {
_knownPos = -1;
if (ioMode != .async) {
raf.truncateSync(newLength);
} else {
await raf.truncate(newLength);
}
} finally {
_releaseIfTransient();
}
}