getOp method

  1. @nonVirtual
StructPointer<D> getOp()

Returns op, throwing a descriptive StateError if unavailable or this instance RaylibTempStructState.isDisposed.

Implementation

@nonVirtual
StructPointer<D> getOp() {
  if ($state.isDisposed) {
    throw StateError(
      '$structName.getOp() was called on a disposed struct. '
      'The pointer is no longer valid and cannot be accessed.'
    );
  }

  if (op == null) {
    if (!_requiresOp) {
      throw StateError('$structName.getOp() was called on a value-type struct that never owns a pointer.');
    } else {
      throw StateError(
        '$structName.getOp() was called but op is null. '
        'This struct requires a raylib-owned pointer but none has been assigned yet.'
      );
    }
  }
  return op!;
}