I'm currently trying my hand at Jetpack Compose and Firebase with the MVVM architecture. In the process, I came across a question that I can't answer with google.
My project is structured as follows:
TaskModel -> data class
TaskListModel -> data class (contains a collection of tasks)
(TaskListModel -> TaskModel = 1:n)
TaskViewModel -> uses TaskRepository (insert, update, get, ...)
TaskListViewModel -> uses TaskListRepository (insert, update, get, ...)
I have learned that a ViewModel is passed to the respective screen by the navigation, so that the screen gets access to the data.
My question: How do I access the TaskModels?
Option 1: Should I do it via the TaskListViewModel, since a TaskList contains a collection of TaskModels?
Option 2: Should I do it via the TaskViewModel by passing the uuid of the TaskList and get the data based on that?
But no matter which option makes more sense, either the collection in the TaskList becomes superfluous or the TaskViewModel becomes superfluous.