changeTheme method

void changeTheme(
  1. ThemeMode requestedMode
)

Updates the user's intent. Pass ThemeMode.system to follow the OS theme — currentMode then resolves to light / dark based on the platform brightness and re-resolves automatically when the OS theme is toggled.

Example:

themeService.changeTheme(ThemeMode.system);

Implementation

void changeTheme(ThemeMode requestedMode) {
  runInAction(() => mode.value = requestedMode);
}