ScopeScrewdriver<T> extension

provides scope functions as extensions on T

on
  • T

Methods

apply(void block(T obj)) → T
Calls the specified function block with this value as its argument and returns this value.
pairWith<V>(V value) Pair<T, V>
alias for to
run<R>(R block(T obj)) → R
Calls the specified function block with this value as its argument and returns this value.
takeIf(bool predicate(T obj)) → T?
Returns this if it satisfies the given predicate or null, if it doesn't.
takeUnless(bool predicate(T obj)) → T?
Returns this if it doesn't satisfy the given predicate or null, if it doesn't.
to<V>(V value) Pair<T, V>
pairs this with given value and returns an instance of Pair