removeTheme method

void removeTheme(
  1. String themeId
)

Removes the theme with the given id dynamically.

If this fails(possibly non existing theme id), throws an error.

Implementation

void removeTheme(String themeId) {
  if (!hasTheme(themeId)) {
    throw Exception('$themeId does not exist.');
  }
  if (currentThemeId == themeId) {
    throw Exception('$themeId is set as current theme.');
  }
  _appThemes.remove(themeId);
  _appThemeIds.remove(themeId);
  notifyListeners();
}