takeIf_ method

T? takeIf_(
  1. bool condition(
    1. T
    )
)

Kotlin-esque "operator" to take this if condition is true, or else return null.

Implementation

T? takeIf_(bool Function(T) condition) => condition(this) ? this : null;