Created
April 11, 2019 14:03
-
-
Save vodamiro/116951aa3f6a3b749becae835e9cbba3 to your computer and use it in GitHub Desktop.
S_A_FunctionsAndLambdas.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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