readCount method

List<E> readCount(
  1. MemoryPointer<RType> p,
  2. int count, [
  3. List<E>? fallback
])

Reads count elements from the array this field points to, within the struct at p.

If the field's pointer is null, returns fallback (or an empty list if it is null).

Throws StateError if the codec doesn't support contiguous arrays.

Implementation

List<E> readCount(MemoryPointer p, int count, [List<E>? fallback]) {
  final ref = codec.deref(p.offsetBy(offset));
  if (ref.isNull) return fallback ?? [];
  return _innerArray().readArray(ref, count);
}