nullIf method

T? nullIf(
  1. bool test(
    1. T
    )
)

Implementation

T? nullIf(bool Function(T) test) => test(this) ? null : this;