Book Image

Mastering Dart

By : Sergey Akopkokhyants
Book Image

Mastering Dart

By: Sergey Akopkokhyants

Overview of this book

Table of Contents (19 chapters)
Mastering Dart
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The Iterable interface


The Iterable interface can be defined as the common behavior of all classes in the collection framework that supports a mechanism to iterate through all the elements of a collection. It is an object that uses an Iterator interface to iterate over all the elements in a collection. There are two abstract classes, IterableBase and IterableMixin, that implement the Iterator interface. The IterableMixin class is perfectly suited to be extended in the mixin solutions. If you plan to create your own implementation of the Iterable interface, you need to extend one of them. There are many different methods in the Iterable interface to help you manipulate the elements in a collection.

Note

The Iterable interface doesn't support adding or removing elements from a collection.

Properties of the Iterable collection

Here is a list of the read-only properties that are common for all collections:

  • length: This property returns the number of elements in a collection

  • isEmpty: This property...