We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5539a6d commit d7511e8Copy full SHA for d7511e8
app/src/main/java/com/lukaslechner/coroutineusecasesonandroid/playground/flow/stateflow/1-stateflow.kt
@@ -0,0 +1,25 @@
1
+package com.lukaslechner.coroutineusecasesonandroid.playground.flow.stateflow
2
+
3
+import kotlinx.coroutines.coroutineScope
4
+import kotlinx.coroutines.flow.MutableStateFlow
5
+import kotlinx.coroutines.flow.update
6
+import kotlinx.coroutines.launch
7
8
+suspend fun main() {
9
10
+ val counter = MutableStateFlow(0)
11
12
+ println(counter.value)
13
14
+ coroutineScope {
15
+ repeat(10_000) {
16
+ launch {
17
+ counter.update { currentValue ->
18
+ currentValue + 1
19
+ }
20
21
22
23
24
25
+}
0 commit comments