addTheme method

void addTheme(
  1. AppTheme newTheme
)

Adds the given theme dynamically.

The theme will get the index as the last theme. If this fails(possibly already existing theme id), throws an Exception.

Implementation

void addTheme(AppTheme newTheme) {
  if (hasTheme(newTheme.id)) {
    throw Exception('${newTheme.id} is already being used as a theme.');
  }
  _appThemes[newTheme.id] = newTheme;
  _appThemeIds.add(newTheme.id);
  notifyListeners();
}