https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

Simon Lin

01/13/2021, 8:39 AM
How do I set the flow to start collecting only when the data meet certain conditions. For example:
Copy code
flowOf(1, 2, 3, 2, 1, 2, 3)
    .startCollectWhen { it == 3 }
    .collect { print(it) }

// Result: 3, 2, 1, 2, 3
d

diesieben07

01/13/2021, 8:46 AM
flow.dropWhile { it != 3 }
❤️ 1
4 Views