takeIf method

T? takeIf(
  1. bool block(
    1. T it
    )
)

Implementation

T? takeIf(bool Function(T it) block) => block(this) ? this : null;