Florian
09/02/2021, 10:04 AMgetLongestCompletedStreak can take a while if the List is large. Will this setup do the list calculation on a background thread?
private val taskStreaksMax =
allTasksWithTaskStatisticsFlow.map { allTasksWithTaskStatistics ->
allTasksWithTaskStatistics.map { taskWithTaskStatistics ->
TaskStreak(
taskWithTaskStatistics.task.id,
taskWithTaskStatistics.taskStatistics.getLongestCompletedStreak()
)
}
}.flowOn(defaultDispatcher)Florian
09/02/2021, 10:33 AMThread.sleep into my sorting function and indeed, with the flowOn it doesn't freeze the screen, but without it it does.Orhan Tozan
09/02/2021, 10:36 AMdefaultDispatcher?Florian
09/02/2021, 10:42 AMDispatchers.DefaultOrhan Tozan
09/02/2021, 10:49 AMFlorian
09/02/2021, 11:09 AMFlorian
09/02/2021, 11:09 AMFlorian
09/02/2021, 11:09 AM