-
|
I'm looking for a way to query a first-matching element among descendants like .querySelector() in html. I'd appreciate if you could advise! Thanks 😊 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
When you call |
Beta Was this translation helpful? Give feedback.
-
|
@renggli |
Beta Was this translation helpful? Give feedback.
findAllElementsreturns a lazyIterable(see the documentation, there is noListwith all elements created). The iterable doesn't do anything until you actually iterate over the elements.When you call
firston 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.