data method

Iterable<num> data()

Implementation

Iterable<num> data() sync* {
  final buffer = bufferView.get();
  final bytes = buffer.data();

  final byteData = bytes.buffer.asByteData();

  final step = componentType.byteSize;
  if ((bytes.lengthInBytes - byteOffset) % step != 0) {
    throw Exception(
      'Accessor data length ${bytes.lengthInBytes} '
      'is not a multiple of the stride $step.',
    );
  }

  for (var cursor = byteOffset;
      cursor < bytes.lengthInBytes;
      cursor += step) {
    yield componentType.parseData(byteData, cursor: cursor);
  }
}