Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
S_A_FunctionsAndLambdas.kt
data class User(val name)
interface UserDataSource {
fun getAllUsers(
onSuccess: (users: List<User>) -> Unit,
onError: (err: Throwable) -> Unit
)
}
// class UpdateDataSourceImpl: UserDataSource { .... }
UpdateDataSourceImpl().getAllUsers(
onSuccess = { users -> print(users) }, // here you consume success state
onError = { err -> print(err.message) } // here you consume error state
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment