TakeIfExtension<T> extension
Extension on T to add takeIf and takeUnless methods.
- on
-
- T
Methods
-
takeIf(
bool predicate(T)) → T? -
Available on T, provided by the TakeIfExtension extension
Evaluates the givenpredicatefunction on the value of typeTand returns the value if thepredicateis true, otherwise returns null. -
takeUnless(
bool predicate(T)) → T? -
Available on T, provided by the TakeIfExtension extension
Evaluates the givenpredicatefunction on the value of typeTand returns the value if thepredicateis false, otherwise returns null.