ThemeController class Null safety

Object which controls the behavior of the theme. This is the object provided through the widget tree.

This implementation is hidden from the external uses. Instead ThemeCommand is exposed which is inherited by this class.

ThemeCommand is a reduced API to ThemeController.

Inheritance

Constructors

ThemeController({required String providerId, required List<AppTheme> themes, required String? defaultThemeId, required bool saveThemesOnChange, required bool loadThemeOnInit, ThemeChanged? onThemeChanged, ThemeControllerHandler? onInitCallback})
Controller which handles updating and controlling current theme. themes determine the list of themes that will be available. themes cannot have conflicting id parameters If conflicting ids were found AssertionError will be thrown. [...]

Properties

allThemes List<AppTheme>
Returns the list of all themes.
read-only
currentThemeId String
Get the current theme id
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
hasListeners bool
Whether any listeners are currently registered. [...]
@protected, read-only, inherited
providerId String
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
theme AppTheme
Get the current theme
read-only

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes. [...]
inherited
addTheme(AppTheme newTheme) → void
Adds the given theme dynamically. [...]
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener and removeListener will throw after the object is disposed). [...]
@mustCallSuper, inherited
forgetSavedTheme() Future<void>
Removes last saved theme configuration.
hasTheme(String themeId) bool
Returns whether there is a theme with the given id.
loadThemeFromDisk() Future<void>
Loads previously saved theme from disk. If this fails(no previous saved theme) it will be ignored. (No exceptions will be thrown)
nextTheme() → void
Cycle to next theme in the theme list. The sequence is determined by the sequence specified in the ThemeProvider in the themes parameter.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyListeners() → void
Call all the registered listeners. [...]
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes. [...]
inherited
removeTheme(String themeId) → void
Removes the theme with the given id dynamically. [...]
saveThemeToDisk() Future<void>
Saves current theme to disk.
setTheme(String themeId) → void
Selects the theme by the given theme id. Throws an AssertionError if the theme id is not found.
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited