:mega: :mega: :mega: kotlinx.coroutines 1.3.6 rele...
# coroutines
v
📣 📣 📣 kotlinx.coroutines 1.3.6 release: •
StateFlow
for reactive state handling is here! • Most of the existing
Flow
operators have left their experimental status •
runInterruptible
primitive for tying cancellation and interruptions • Integration module for RxJava3 • Integration with BlockHound to detect inappropriate blocking calls Thanks to all contributors! Full changelog: https://github.com/Kotlin/kotlinx.coroutines/releases/tag/1.3.6
⏸️ 22
🚀 9
🎉 47
d
are there any docs on how to integrate with BlockHound?
s
Wow… the
StateFlow
api addition was speeeeedy! 🙂
v
v
@Dariusz Kuc our integration is automatically discovered by BlockHound, it’s enough to enable it (https://github.com/reactor/BlockHound/blob/master/docs/quick_start.md)
🎉 1
d
Awesome!!!
m
Awesome! I just put up a PR to upgrade our Android project to this. We run
lint
against our project and seems that with this update, we are running into the following lint error:
Copy code
Error: Invalid package reference in org.jetbrains.kotlinx:kotlinx-coroutines-core; not included in Android: java.lang.instrument. Referenced from kotlinx.coroutines.debug.AgentPremain. [InvalidPackage]
Any thoughts?
v
You can safely disable this warning in your config, meanwhile I will think about a way to fix it without changing everyone’s lint config
👍 1
m
Looks like an issue has already been filed for this. https://github.com/Kotlin/kotlinx.coroutines/issues/2004
r
Awesome work JB Team @elizarov
u
Is StateFlow rx BehaviorRelay?
g
@ursus no, it’s more like LiveData
s
MutableStateFlows are like BehaviorSubjects in Rx, but MutableStateFlow must have an initial value.
m
can any1 please clarify this: 'if you put events into the 
StateFlow
, protect them from double-processing with flags'. I dont understand its meaning
r
It probably means ,so the events don't get re-triggered when the flow gets collected from agian . Thats what I thought it ment when I read it in the documentation last night. but don't quote me on in it. might be completely wrong lol
m
oh yes that was my instinct as well. To be honest, this StateFlow was not what i was expecting, at least until it's complete. The only few use cases that is missing from Flow is the ability to share a single collector, for instance, observe something and every time that flow is collected, just compute the chain once. Something like a 'share' operator. I was expecting StateFlow to cover that, and it doesn't for now. I don't see any benefit over ConflatedBroadCastChannel for now. May be wrong
This:
Copy code
val stateFlow = flow { Random.nextInt() }.shareIn(thisScope)

Assert.assertEquals(
    stateFlow.first(),
    stateFlow.first()
)
For me, the only thing missing in flow api. Other use cases i can cover with custom operators
r
@myanmarking
m
yes, thank you i was aware. Unfortunatly, still coming 😛
😂 1
r
No prob dude
u
so refCount, replay, etc is still not there?
e
They’ll come a bit later.
👍 3
b
I might be looking in the wrong place; I am not seeing the new version in maven https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core Hopefully there will be a new native-mt release; there's at least one bug fix I am eagerly awaiting.
o
I think mvnrepository is just indexing a bit slow, they're certainly in central: https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.3.6/