Skip to content

Is there a way to query only one element among descendants? #115

Answered by renggli
mtskf asked this question in Q&A
Discussion options

You must be logged in to vote

findAllElements returns a lazy Iterable (see the documentation, there is no List with all elements created). The iterable doesn't do anything until you actually iterate over the elements.

When you call first on the iterator, it starts to traverse the tree until it finds the first matching element, aborts the traversal, and returns that element. Check out the Dart tutorial on Iterable collections for other operations.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by renggli
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #114 on December 29, 2021 11:05.