GenericScrewdriver<T extends Object> extension
provides scope functions as extensions on T
- on
-
- T
Methods
-
apply(
void block(T obj)) → T -
Calls the specified function
block
withthis
value as its argument and returnsthis
value. -
run<
R> (R block(T obj)) → R -
Calls the specified function
block
withthis
value as its argument and returnsthis
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. -
tryCast<
R> () → R? - A safe cast operation that returns null if the cast is not possible. Otherwise, returns the casted value.