kotlin-coroutines Questions

6

Solved

I'm looking for the most "clean" way to implement the following logic: I have N methods, everyone returns Flow<Result<SOME_TYPE>> (type are different) I want to chain these m...
Mccusker asked 11/10, 2020 at 12:16

2

What is the right way to create an aspect around Kotlin suspended function? From my observation, Micrometer's @Timed aspect does work with them, but shows incorrect result - looks like it measures...
Retro asked 29/12, 2018 at 22:11

3

Solved

I would like to read a file contents and emit a flow for every line of its contents. So, I have to implement a function with the following signature: fun InputStream.linesToFlow(): Flow<String&...
Creon asked 15/5, 2020 at 17:44

7

I am using Room Db using coroutines in kotlin. This is my Dao interface: @Dao interface CheckListNameDao { @Insert suspend fun insertName(name: CheckListName) @Query("SELECT * FROM CheckLis...
Hardening asked 4/2, 2020 at 5:12

2

I installed the new version of Android Studio and did update of my project (without changing dependencies) and i had this issue: Missing class com.google.protobuf.java_com_google_android_gmscore_sd...
Agentival asked 20/4, 2023 at 11:8

4

Solved

I am new to Kotlin/Coroutines, so hopefully I am just missing something/don't fully understand how to structure my code for the problem I am trying to solve. Essentially, I am taking a list of st...
Restrict asked 16/2, 2019 at 4:22

4

I want to know a practical scenario of both of them. I know the difference but couldn't relate to my implementation.
Wagstaff asked 6/1, 2022 at 5:28

2

Solved

When is it appropriate to use Dispatchers.Unconfined vs EmptyCoroutineContext? My use case is that I want to create an API for intercepting network calls. I want to provide an optional parameter t...
Kylix asked 14/3, 2019 at 18:30

3

Solved

Trying to build a simple example that uses kotlin coroutines in an activity: lifecycleScope.launch { val result = httpGet("http://hmkcode-api.appspot.com/rest/api/hello/Android") textView.setTe...
Nunez asked 18/3, 2020 at 16:51

2

Solved

I'm following the "Kotlin coroutine deep dive" book to understand coroutine a bit further. I came across the below statement in the book which I can't understand clearly and would be help...
Ephedrine asked 16/5, 2023 at 5:58

1

I'm a developer who's coming from RxJava and is trying to get into coroutines. RxJava has a couple of extremely useful operators, withLatestFrom, throttleFirst, etc. and I can't seem to find an equ...
Traceable asked 2/9, 2019 at 8:50

9

Solved

Trying to run some examples for Kotlin coroutines, but can't build my project. I'm using the latest gradle release - 4.1 Any suggestions what to check/fix? Here is build.gradle buildscript { ex...
Bump asked 10/9, 2017 at 0:0

3

Solved

I am studying about CPS. I was wondering how does it work. Object createPost( Token token, Item item, Continuation<Post> const){...} interface Continuation<in T> { val context: Cor...
Sherlock asked 11/9, 2022 at 13:1

3

Solved

I have a database query that returns the list of indexes of objects for a certain day, i.e.: getIndexesOfDay(day: Day): Flow<List<String>> Now, I need to listen for details for each in...
Jessie asked 18/11, 2021 at 19:35

6

I've been using lifecyclesScope's launchWhenResumed for a long time now, but it seems to be deprecated. The documentation says to use repeatOnLifecycle() but I only want the code to run once, just ...
Scutage asked 4/3, 2023 at 12:3

9

I'm new at testing, trying to take second flow value and assert it, When i run this test one by one runs fine but when i run whole test once first test runs fine and rest of test give me timeout er...
Meridethmeridian asked 5/6, 2022 at 10:5

7

I have a Room database that returns a Flow of objects. When I insert a new item into the database, the Flow's collect function only triggers if the insert was performed from the same Fragment/ViewM...
Narceine asked 16/11, 2020 at 21:33

3

Solved

My LazyColumn is not recomposing but the value is getting updated. If I scroll down the list and scroll back up I see correct values for the UI MainActivity class MainActivity : AppCompatActivity()...

8

Solved

Context In Jetpack compose, we have the option of using rememberCoroutineScope() as well as using the LaunchedEffect composable in order to use coroutines / run suspend functions (show snackbars et...
Protoxylem asked 4/3, 2021 at 11:24

2

Solved

I want to run a periodic task. In Spring MVC it works flawlessly. Now I want to integrate Spring Webflux + Kotlin Coroutines. How can I call suspended functions in the @Scheduled method? I want it ...

1

I'm trying to dive into coroutines world, trying to make some network work in Service (in fact LifecycleService). after starting it I'm calling below method private fun runConnectionCoroutine() { ...
Noland asked 22/6, 2021 at 9:12

4

Solved

I have ViewModel with Kotlin sealed class to provide different states for UI. Also, I use androidx.compose.runtime.State object to notify UI about changes in state. If error on MyApi request occurs...
Counterintelligence asked 31/3, 2021 at 16:6

5

Solved

I'm using Retrofit 2.7.1 with Kotlin coroutines. I have a Retrofit service defined as such: @PUT("/users/{userId}.json") suspend fun updateUserProfile( @Path("userId") userId: String, @Query("d...
Broth asked 7/1, 2020 at 21:19

3

I've just started looking at Room, Coroutines, and Flow, and have come across something odd: what I'm expecting to be an empty flow actually has one null item in it. My setup is as follows, with g...

3

I'm developing an Android library, When the user receives a push notification it may contain deep links, that I need to return to the app. I did in kotlin with no problem. This is the function t...
Esra asked 27/5, 2020 at 18:20

© 2022 - 2025 — McMap. All rights reserved.