takeIf<T> method

Any? takeIf<T>(
  1. bool predicate(
    1. Any
    )
)

Returns this value if it satisfies the given predicate or null, if it doesn't.

Implementation

Any? takeIf<T>(bool Function(Any) predicate) => predicate(this) ? this : null;