kotlinx.coroutines.flow Questions

1

I am trying to create a moving window of data using Kotlin Flows. It can be achieved in RxKotlin using a buffer, but buffer is not the same using Flows. RxKotlin has a buffer operator, periodically...
Necessitous asked 12/12, 2021 at 20:13

2

Solved

I've one LiveData named sortOrder and then I've another variable named myData that observes any change to sortOrder and populates data accordingly. class TestViewModel @ViewModelInject constructor(...

3

Solved

I notice a strange behavior when trying to prematurely cancel from a Flow. Take a look at the following example. This is a simple flow that emits integer values private fun createFlow() = flow {...
Coverture asked 10/1, 2020 at 11:11

3

Solved

In the last Google I/O, Jose Alcerreca and Yigit Boyar told us that we should no longer use LiveData to fetch data. Now we should use suspend functions for one-shot fetches and use Kotlin's Flow to...

3

Solved

I wanted to know how can I send/emit items to a Kotlin.Flow, so my use case is: In the consumer/ViewModel/Presenter I can subscribe with the collect function: fun observe() { coroutineScope.laun...

2

Solved

I'm trying to deliver realtime updates to my view with Kotlin Flows and Firebase. This is how I collect my realtime data from my ViewModel: class MainViewModel(repo: IRepo): ViewModel() { val f...

1

Solved

I'm replacing my current implementation using RxJava to Coroutines and Flow. I'm having some trouble using some Flow operators. I'm trying to filter the list of items inside a Flow before providin...
Unruly asked 22/12, 2019 at 14:30

3

Solved

I am trying to migrate from LiveData to Flow in my Room Dao. App is working fine, but I have problems with testing behavior. When I run the test it is starting and running indefinately. I also trie...
1

© 2022 - 2024 — McMap. All rights reserved.