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

Lilly

03/29/2021, 3:51 PM
Is it possible to receive from a
Channel
without removing the element?
z

Zach Klippenstein (he/him) [MOD]

03/29/2021, 5:38 PM
nope, there’s no peek
i

Ian Lake

03/29/2021, 9:55 PM
If you are making your Channel into a flow via
receiveAsFlow()
(as you should to process elements from it like the example in https://elizarov.medium.com/shared-flows-broadcast-channels-899b675e805c#49e3), then you could attach an
onEach
to the Flow to process each element coming through
l

Lilly

03/30/2021, 11:08 AM
ok thanks guys
2 Views