ok property
T?
get
ok
Returns the success value if this is an Ok, otherwise null.
Warning: If T is nullable, this method cannot distinguish between
Ok(null) and Err(...) — both return null. For nullable T, use
toOption for safe extraction, or isOk to check the state first.
For most cases, prefer unwrapOr, unwrapOrNull, or isOkAnd instead of this getter for clearer intent.
Implementation
T? get ok => switch (this) {
Ok(:final value) => value,
Err() => null,
};