Questions tagged [kotlin-flow]

In Kotlin coroutines, a Flow is a stream of asynchronously computed values. Use this tag when you're having problems building, transforming or consuming flows.

In Kotlin coroutines, a Flow is stream of asynchronously computed values.

Documentation: https://kotlinlang.org/docs/flow.html#flows

895 questions
0
votes
0 answers

Parallel IO requests with Kotlin Flow, Coroutines and NOT suspend function

I run my Netty based Kotlin application with Spring Boot and WebFlux. The details are as follows: Java 11; Kotlin 1.3.61; Spring Boot 2.2.5.RELEASE; Spring Vault Core 2.2.2.RELEASE. I get a file on the web layer. WebFlux creates a Part…
0
votes
0 answers

Kotlin Flow: not enough information to infer type variable inside Flow's builder function

I have this extension function: inline operator fun SharedPreferences.get(key: String, defaultValue: T? = null): T? { return when (T::class) { String::class -> getString(key, defaultValue as? String ?: "") as T …
0
votes
1 answer

Double subscriptions on inner flow with kotlin-flow

I have the following problem with my code snippet below; When the set of currently connected barcode-scanners changes, a set with the currently connected scanners will be emitted by the scanners: Flow> flow. If I have connected…
Mark Ebbers
  • 187
  • 3
  • 13
-1
votes
1 answer

Cannot collect kotlin Flow

My code always exit when executing this line, actually i already use coroutine to execute the collector code, and already use updated library for coroutine also viewModel.rtList.collect{ list -> adapter.submitList(list) } and here is my full…
asqa
  • 199
  • 3
  • 17
-1
votes
1 answer

Room Flow Always returns kotlinx.coroutines.flow.SafeFlow@c8abe2e

Initially i am getting list data from network and store it in room db. It is One to Many Relationship. For that i have created Two Tables and One Relationship data class Product Table : @Entity(tableName = "Product") data class Products ( …
SasidharanIOS
  • 252
  • 1
  • 3
  • 12
-1
votes
1 answer

What is the operator chain to make a Kotlin Flow emit only if it's emissions are constant for a given time?

I am creating a text recognition app and I want the flow to emit values only if the result is constant for a given duration. Also if no value is emitted for a certain amount of time, reject the previous value.
-1
votes
1 answer

How to share BroadcastChannel between scopes?

I have a BroadcastChannel as a buffer. I send values at one scope and would like to observe them using flow at another. My code is: val channel = BroadcastChannel(1) val observable = channel.asFlow() someScope.launch { …
Alex Klimashevsky
  • 2,457
  • 3
  • 26
  • 58
-2
votes
2 answers

Events emitted by MutableSharedFlow from ViewModel are not collected in Jetpack Composable Function Kotlin

I have a scenario where I make a call to a method in ViewModel as a first statement in my Composable Function. I try to collect events from ViewModel's MutableStateFlow in LaunchedEffect()block of my Composable Function. The problem is the events…
1 2 3
59
60