readBytes method

  1. @override
Future<Uint8List> readBytes(
  1. int offset,
  2. int count
)
override

Read count bytes starting at offset. Returns fewer bytes if EOF.

Implementation

@override
Future<Uint8List> readBytes(int offset, int count) async {
  await _raf.setPosition(offset);
  final data = await _raf.read(count);
  if (data.length < count) {
    final buf = Uint8List(count);
    buf.setAll(0, data);
    return buf;
  }
  return Uint8List.fromList(data);
}