TakeExtension<T extends Object> extension
Extension for conditionally filtering values.
Provides methods to return the value (as-is) or null based on conditions, useful for filtering in chains or implementing optional transformations.
- on
-
- T
Methods
-
takeIf(
bool condition) → T? -
Available on T, provided by the TakeExtension extension
Returns this value ifconditionis true, otherwise null. -
takeIfLazy(
bool predicate(T value)) → T? -
Available on T, provided by the TakeExtension extension
Returns this value ifpredicatereturns true for it, otherwise null. -
takeUnless(
bool condition) → T? -
Available on T, provided by the TakeExtension extension
Returns this value ifconditionis false, otherwise null. -
takeUnlessLazy(
bool predicate(T value)) → T? -
Available on T, provided by the TakeExtension extension
Returns this value ifpredicatereturns false for it, otherwise null.