title: Migrating a MediatorLiveData to SharedFlow
body: <p>I have a MediatorLiveData that uses three LiveData sources. When any of them emits a new value and I have at least one of each, I use the three values to produce the output for the UI.</p>
  <p>Two of the sources are user settings for how to sort and filter a list, and the third is the list data, pulled from a Room database Flow.</p>
  <p>It looks something like this:</p>
  <pre><code>val thingsLiveData: LiveData&lt;List&lt;Thing&gt;&gt; = object: MediatorLiveData&lt;List&lt;Thing&gt;&gt;() {
      var isSettingA: Boolean = true
      var settingB: MySortingEnum = MySortingEnum.Alphabetical
      var data: List&lt;Thing&gt;? = null
      init {
          addSource(myRepo.thingsFlow.asLiveData()) {
              data = it
              dataToValue()
          }
          addSource(settingALiveData) {
              isSettingA= it
              dataToValue()
          }
          addSource(settingBLiveData) {
              settingB= it
              dataToValue()
          }
      }
      private fun dataToValue() {
          data?.let { data -&gt;
              viewModelScope.launch {
                  val uiList = withContext(Dispatchers.Default) {
                      produceUiList(data, isSettingA, settingB)
                  }
                  value = listItems
              }
          }
      }
  }
  </code></pre>
  <p>I'm looking for a clean way to convert this to a SharedFlow, preferably without any <code>@ExperimentalCoroutinesApi</code>. The only SharedFlow builder function I've come across is <code>callbackFlow</code>, which isn't applicable. Are you intended to use <code>flow { ... }.asSharedFlow(...)</code> in most cases, and if so, what would that look like here?</p>
  <p>The two settings LiveData I also plan to migrate to flows.</p>