ThemeViewModel

ViewModel responsible for managing the application's theme state (dark or light mode). It holds the current theme preference and provides a way to toggle it. UI components can observe the theme state from this ViewModel to reactively update their appearance.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val isDarkTheme: StateFlow<Boolean>

Functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
Link copied to clipboard

Toggles the current theme preference. If the current theme is dark, it changes to light, and vice versa. This method updates the internal _isDarkTheme StateFlow, which in turn notifies any observers of isDarkTheme.