setThemeByKey static method
If you call setThemeByKey with a key
, and a theme was previously saved with that key
(by using the save method), then the current theme will immediately change into that theme.
However, if a theme was NOT previously saved with that key
, then the current theme will
not change immediately, but may change later, as soon as you save a theme with that key
.
In other words, you can first save a them then set it, or you can first set it and then save it.
Implementation
static void setThemeByKey(Object key) {
var theme = _saved[key];
if (theme == null)
_delayedThemeChangeByKey = key;
else {
_delayedThemeChangeByKey = null;
currentTheme = _saved[key];
}
}