Created
April 11, 2019 14:11
-
-
Save vodamiro/11e2ec25a9a60c2c4696df52af572c4b 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