all method

bool all(
  1. bool predicate(
    1. E element
    )
)

Returns true if all elements match the given predicate or if the collection is empty.

Implementation

bool all(bool Function(E element) predicate) {
  for (var element in this) {
    if (!predicate(element)) {
      return false;
    }
  }
  return true;
}