Generators
Prerequisite: Iteration, Iterator , Iterable
In simple words , iterable is something you can loop over or a collection of values that can be accessed sequentially
Iterator is something that remember can "where it is " i.e. current position during iteration

Documentation
Sync Generators
There are two types of Generators in Dart
Synchronous Generator
Returns an iterableAsynchronous Generator
Returns a stream
In a normal function you would expect the function body to execute when you call the function , but in case of generator it doesn't execute
The generator starts executing when you start iterating over iterable it returned
Async Generators
Last updated
Was this helpful?