takeIf method
Returns this if it satisfies predicate, otherwise null.
Useful for conditional filtering in a chain:
value.takeIf((v) => v > 0)?.let((v) => process(v));
Implementation
T? takeIf(bool Function(T it) predicate) => predicate(this) ? this : null;