validate method
Returns an empty iterable if this iterable is null
, otherwise filters out null
values.
Example:
Iterable<int?>? numbers = [null, 2, 3];
print(numbers.validate()); // Output: [2, 3]
Implementation
Iterable<T> validate() => this?.whereType<T>() ?? const Iterable.empty();