The `iterator` property of the `Rune` class returns a new Iterator that allows iterating the elements of the Rune, which can represent characters, emojis, or Unicode code points.
The syntax of Runes.iterator property is:
RuneIterator iterator
This iterator property of Runes returns a new Iterator
that allows iterating the elements of this Iterable
.
Runes.iterator returns value of type RuneIterator
.
In this example,
runes
with the string 'ABC'.iterator
property.moveNext()
and print each element using current
.void main() {
Runes runes = Runes('ABC');
var iterator = runes.iterator;
while (iterator.moveNext()) {
print(iterator.current);
}
}
65 66 67
In this example,
runes
with the emoji '🚀'.iterator
property.moveNext()
and print each element using current
.void main() {
Runes runes = Runes('🚀');
var iterator = runes.iterator;
while (iterator.moveNext()) {
print(iterator.current);
}
}
128640
In this Dart tutorial, we learned about iterator property of Runes: the syntax and few working examples with output and detailed explanation for each example.