Right Place To Offer Or Send Channel In Mvi Pattern
I load data in recycleView in advance. In order to do that I have following code in onCreate() of Activity : override fun onCreate(savedInstanceState: Bundle?) { super.onCr
Solution 1:
The only solution that I found is moving fetchUser
method and another _state
as MutableStateFlow to Repository layer and observeForever
it in Repository for local unit test, as a result I can send or offer userIntent
in init block off ViewModel.
I will have following _state
in ViewModel :
val userIntent = Channel<MainIntent>(Channel.UNLIMITED)
privateval _state = repository.state
val state: StateFlow<MainState>
get() = _state
Post a Comment for "Right Place To Offer Or Send Channel In Mvi Pattern"