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 PMLucien Guimaraes
05/27/2021, 3:26 PMNo cast needed on as HomeStatestojan
05/27/2021, 3:28 PM.map<HomeState> { stuff -> HomeState.Success(stuff) }
should also work