Hi, I am using the databinding and ViewModel with the repository pattern. My repository is exposing ...
h
Hi, I am using the databinding and ViewModel with the repository pattern. My repository is exposing Flow that contains Result wrapper (indicates Loading, Success or Failure state). I could convert Flow to LiveData in ViewModel and observe (and handle) changes in a fragment, but since I am using databinding, it seems to me as one extra step. Therefore, is there a way how to safely collect flows in the ViewModel?
h
Thank you. The problem is I have to parse the result from the flow, and cannot simply map flow to anything else. I have used the shareIn() method with started=WhileSubscribed but I am not sure if it's completely safe.