Tolriq
11/17/2020, 1:14 PMasSharedFlow()
on a MutableSharedFlow
vs just exposing the MutableSharedFlow
as a SharedFlow
?wasyl
11/17/2020, 1:25 PMMutableSharedFlow
as SharedFlow
then someone could still cast it back to Mutable..
and send values to it. asSharedFlow
fully hides the underlying mutable shared flow from consumersTolriq
11/17/2020, 1:31 PMwasyl
11/17/2020, 1:35 PMasSharedFlow
is imo good practice. Even if you don’t develop a library, it’s still good to make it impossible to make a mistake by fellow devs — I can imagine someone doing if (someFlow is MutableSharedFlow) someFlow.castAndSend(x)
with good intentions