read method

  1. @override
Future<Uint8List> read(
  1. int offset,
  2. int length
)
override

Reads exactly length bytes starting at byte offset.

Throws UnexpectedEofException if the range extends past the end of the source and ArchiveClosedException if the source is closed.

Implementation

@override
Future<Uint8List> read(int offset, int length) async {
  checkByteSourceRange(this, offset, length);
  if (_closed) {
    throw ArchiveClosedException('read($offset, $length) after close()');
  }
  final buffer =
      await _blob.slice(offset, offset + length).arrayBuffer().toDart;
  return buffer.toDart.asUint8List();
}