Skip to content

Instantly share code, notes, and snippets.

@igorescodro
Created March 10, 2021 14:57
Show Gist options
  • Save igorescodro/95b7a965fdf14f86fb8f15d06b586f55 to your computer and use it in GitHub Desktop.
Save igorescodro/95b7a965fdf14f86fb8f15d06b586f55 to your computer and use it in GitHub Desktop.
fun loadTaskInfo(taskId: TaskId): Flow<TaskDetailState> = flow {
val task = loadTaskUseCase(taskId = taskId.value)
if (task != null) {
emit(TaskDetailState.Loaded(task))
} else {
emit(TaskDetailState.Error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment