createViewModel
Creates and returns the appropriate ViewModel instance based on the current Page type.
This extension function acts as a factory method that maps each page type to its corresponding ViewModel implementation. It properly wires up all dependencies including coroutine scopes, state management callbacks, and navigation handlers.
Receiver
The Page instance for which to create a ViewModel.
Return
A ViewModel instance appropriate for the current page type.
Parameters
The CoroutineScope used for launching coroutines within ViewModels.
The current application state providing access to game, theme, and service.
Mutable state holding the current game session (game + player name).
Mutable state holding audio and theme configuration.
Mutable state holding current page and navigation state.