Skip to content

Instantly share code, notes, and snippets.

@hugoangeles0810
Created January 15, 2018 00:16
Show Gist options
  • Select an option

  • Save hugoangeles0810/30e4eca15e7f97892d7ad8d89143dc0e to your computer and use it in GitHub Desktop.

Select an option

Save hugoangeles0810/30e4eca15e7f97892d7ad8d89143dc0e to your computer and use it in GitHub Desktop.
Uso de inyección de dependencias
class ColorsRepository(val restDataSource: RestDataSource, val sqliteDataSource: SQLiteDataSource) {
fun listColors(): List<Color> {
val colors = restDataSource.listColor()
sqliteDataSource.saveOrUpdateColors(colors)
return colors
}
fun listLocalColors(): List<Color> {
return sqliteDataSource.listColors()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment