takeUnless method

T? takeUnless(
  1. bool predicate(
    1. T it
    )
)

Returns the receiver if non-null and does NOT satisfy predicate, otherwise null.

Implementation

T? takeUnless(bool Function(T it) predicate) {
  final value = this;
  if (value == null) return null;
  return !predicate(value) ? value : null;
}