NullableWhen<T> extension
Null-aware helpers for any nullable receiver T?: run a side effect,
transform, or supply a fallback only when (or unless) the value is null.
Roadmap #351-365.
- on
-
- T?
Methods
-
mapNonNull<
R> (R fn(T)) → R? -
Available on T?, provided by the NullableWhen extension
Transforms a non-null value withfn, or returns null when the receiver is null. -
orElse(
T compute()) → T -
Available on T?, provided by the NullableWhen extension
Returns the value when non-null, otherwise the result ofcompute. -
whenNonNull(
void fn(T)) → T? -
Available on T?, provided by the NullableWhen extension
Runsfnwith the value when it is non-null, then returns the original receiver unchanged (null or not) so calls can be chained.