takeUnless method

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

Returns this value if predicate is false, otherwise null.

name.takeUnless((n) => n.isEmpty) // name or null

Implementation

T? takeUnless(bool Function(T) predicate) => predicate(this) ? null : this;