isActiveCustomTheme static method

bool isActiveCustomTheme(
  1. String name
)

Returns true if the custom theme with the given name is currently active.

Throws Exception if name is 'light' or 'dark' — use isDarkMode or isLightMode instead for built-in themes.

Example:

if (Themed.isActiveCustomTheme('ocean')) {
  print('Ocean theme is active');
}

Implementation

static bool isActiveCustomTheme(String name) {
  if (name == 'light' || name == 'dark') {
    throw Exception(
      'Use isDarkMode or isLightMode for built-in themes',
    );
  }

  return _instance._currentThemeName == name;
}