Skip to content

Instantly share code, notes, and snippets.

View RekcahA's full-sized avatar

Mohammad Sadegh Mirnasab RekcahA

View GitHub Profile
private val addNewTodoEffect = Transformer<State, Event, Event> { upstream ->
upstream.ofEventType(Event.NewTodoEvent::class)
.observeOn(Schedulers.io())
.switchMap { (_, _, event) ->
db.todoDao().add(
TodoEntity(
id = 0,
text = event.text,
completed = false
)