Iterator<T> class

This interface defines properties and methods for iterating over a collection; it provides the #next predicate and the #value read-only property. Some Iterators also provide key property values along with each value.

Typical usage is:

 var it = anIterableCollection.iterator;
 while (it.next()) {
   var item = it.value;
 }

Many iterators will signal an error if #next is called after the underlying collection has been modified.

To avoid confusion when dealing with Iterables, iterators implement the Iterable#iterator property by just returning themselves.

Implemented types
Available Extensions
Annotations
  • @JS()
  • @staticInterop
  • @anonymous

Constructors

Iterator({Iterator? iterator, dynamic value, dynamic key, num? count, bool next()?, bool hasNext()?, dynamic first()?, void reset()?, bool any(bool (dynamic))?, bool all(bool (dynamic))?, void each(void (dynamic))?, Iterator<S> map<S>(S (dynamic))?, Iterator filter(bool (dynamic))?})
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited