title: State Management with ViewModel on Android when on a flow
body: <p>Basically I have a state management system using <code>ViewModel</code> that looks like this: </p>
  
  <pre class="lang-kotlin prettyprint-override"><code>class ViewModelA: ViewModel() {
  
      private val repository: RepositoryA by inject()
  
      private val _stateLiveData = MutableLiveData&lt;ViewState&gt;()
      val stateLiveData: LiveData&lt;ViewState&gt; get() = _stateLiveData
  
      private val _eventLiveData = SingleLiveEvent&lt;ViewEvent&gt;()
      val eventLiveData: LiveData&lt;ViewEvent&gt; get() = _eventLiveData
  
      private val exceptionHandler = CoroutineExceptionHandler { _, _ -&gt;
          _stateLiveData.postValue(ViewState.Error)
      }
  
      fun loadList() {
          if (_stateLiveData.value is ViewState.Loading) return
          launch(exceptionHandler) {
              _stateLiveData.run {
                  value = ViewState.Loading
                  value = repository.getDocumentList().let {
                      if (it.isEmpty()) ViewState.Error
                      else ViewState.Data(it)
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>But whenever I am sharing a <code>ViewModel</code> with several <code>Fragments</code>, it becomes bigger and bigger. I am looking for a solution for this, because I don't want to centralize all the logic for an entire application flow inside a <code>ViewModel</code> and I also don't want to pass arguments here and there all the time.</p>
  
  <p>PS: Sorry about my bad english.
  Edit: Clarify a bit the question.</p>