append method

  1. @override
Future<void> append(
  1. List<int> bytes
)
override

Appends bytes to the end of the sink.

Implementation

@override
Future<void> append(List<int> bytes) => _synchronized(() async {
  _validateBytes(bytes);
  final nextLength = ByteRange.checkedAdd(_length, bytes.length);
  try {
    await _handle.setPosition(_length);
    await _handle.writeFrom(bytes);
    _length = nextLength;
  } on FileSystemException catch (error) {
    throw ByteSinkIoException(
      operation: 'append bytes',
      cause: error,
      location: _staging.path,
    );
  }
});