asFlow

fun <T> TreeNode<T>.asFlow(order: TreeNodeIterators = TreeNodeIterators.PreOrder): Flow<TreeNode<T>>(source)

Emits this node and all of its descendants as a cold Flow, traversed in the given order. Useful for plugging tree traversal into coroutine/Flow pipelines (e.g. in a ViewModel).