Package selection guidance compiled from public package information, community data, and project usage.
A Flutter package that enables dynamic theme mode switching at runtime and persists the selected theme across app restarts. It simplifies handling light and dark mode preferences by automatically saving the user's choice to shared preferences, ensuring consistency when the app is reopened. The widget integrates seamlessly into existing Flutter apps with minimal setup, offering a reliable way to manage theme state without manual storage logic.
Limited to themeMode only (not full theme customization)
May need additional logic for custom themes
Not suitable for complex theme management beyond mode switching
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
theme_mode_handler
This library is considered done - no new features or changes are foreseen.
You may not see recent updates to this repository, but the library is totally functional.
Please open an issue if you find an issue
or think something is missing so we can discuss it.
Flutter widget to change themeMode during runtime and persist it across restarts.
Motivation
Flutter 1.9 introduced a new way to control which theme is used: MaterialApp.themeMode. If you have specified the darkTheme and theme properties, you can use themeMode to control it. The property defaults to ThemeMode.system.
This package wraps this functionality and allows you to persist and retrieve the user's preference wherever you want by implementing an interface.
Installation
Add this to your pubspec.yaml:
dependencies:theme_mode_handler:^3.0.0
Usage
Create a class that implements the IThemeModeManager interface: