takeIf method
Returns value if it satisfies the predicate, otherwise null Usage: number.takeIf((it) => it > 0)
Implementation
T? takeIf(bool Function(T it) predicate) {
return predicate(this) ? this : null;
}
Returns value if it satisfies the predicate, otherwise null Usage: number.takeIf((it) => it > 0)
T? takeIf(bool Function(T it) predicate) {
return predicate(this) ? this : null;
}