none method Null safety

bool none(
  1. Predicate<E> test
)

Returns true if no elements match the given predicate test.

Also returns true, if the receiver is null or empty.

Implementation

bool none(Predicate<E> test) {
  final self = this;
  if (self != null && self.isNotEmpty) {
    for (var element in self) {
      if (test(element)) return false;
    }
  }
  return true;
}