Skip to content

Instantly share code, notes, and snippets.

@igorescodro
Created March 10, 2021 13:45
Show Gist options
  • Save igorescodro/7274021097fd153a69ac5af080bb8623 to your computer and use it in GitHub Desktop.
Save igorescodro/7274021097fd153a69ac5af080bb8623 to your computer and use it in GitHub Desktop.
fun loadTaskList(): Flow<TaskListViewState> = flow {
loadAllTasksUseCase().collect { tasks ->
val state = if (tasks.isNotEmpty()) {
TaskListViewState.Loaded(tasks)
} else {
TaskListViewState.Empty
}
emit(state)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment