takeIf method

T? takeIf(
  1. bool predicate(
    1. T
    )
)

Implementation

@pragma('vm:prefer-inline')
T? takeIf(bool Function(T) predicate) {
  if (predicate(this)) return this;
  return null;
}