If I wanted to create a “view controller” class fo...
# android
m
If I wanted to create a “view controller” class for a composable view that would then have a viewmodel injected into it by it’s controlling fragment, would it be safe to use the viewmodel coroutine scope in the view controller to observe a flow from the viewmodel? e.g.
Copy code
class MyFragment : Fragment() {
    // get MyComposableViewModel
    // create MyComposableView with a layout and MyComposableViewModel
}

class MyComposableView(layout: LinearLayout, viewmodel: MyComposableViewModel) {
    viewmodel.collectFlow().onEach {
    }.launchIn(viewmodel.viewModelScope)
}