Hi I have a question: what would be the best practice to pass viewModelScope to the helper/manager class used in viewModel.
For example, I would like to create an AccountManager class that would take care of the account, perform some async task operations, read/write from the database etc... I want to expose the result through Kotlin Flow and collect it in my ViewModel, and for that reason I need to access viewModelScope (so I can emit values), because creating a new scope doesn't seem like a very good idea.
I'm using Hilt dependency injection, and I would like to inject account manager as a dependency in ViewModel. Also, one thing worth mentioning is that I would like to use this Account Manager in more than one place in my app, because it's encapsulating some repetitive operations. There is a concern that if I create AccountManager as a Singleton I could create memory leak if I pass a particular viewModelScope to it... So basically I need your opinion what would be the best solution for this?