Lucien Guimaraes
05/27/2021, 3:21 PMhomeRepository
.requestStuff()
.map { stuff -> HomeState.Success(stuff) }
.catch {
emit(HomeState.Error.Unknown(it)) <- type mismatch as FlowCollector is waiting for the HomeState.Success type
}
By adding .filterIsInstance<HomeState>()
before .catch {...}
it works, but I'm wondering if there is a better way 🤔
Thanks!Adam Powell
05/27/2021, 3:23 PM.map { stuff -> HomeState.Success(stuff) as HomeState }
Lucien Guimaraes
05/27/2021, 3:24 PMNo cast needed
on as HomeState
stojan
05/27/2021, 3:28 PM.map<HomeState> { stuff -> HomeState.Success(stuff) }
should also work