readBytes method
Read count bytes starting at offset. Returns fewer bytes if EOF.
Implementation
@override
Future<Uint8List> readBytes(int offset, int count) async {
final buf = _buf;
if (offset >= buf.length) return Uint8List(count);
final end = (offset + count).clamp(0, buf.length);
final data = buf.sublist(offset, end);
if (data.length < count) {
final result = Uint8List(count);
result.setAll(0, data);
return result;
}
return Uint8List.fromList(data);
}