setTheme method

void setTheme(
  1. ArcaneTheme theme
)

Updates the app's theme dynamically, triggering a targeted rebuild.

This method applies a new ArcaneTheme, updating _theme and calling setState to refresh the widget tree. It announces the change for logging and ensures efficient propagation to MaterialApp-like structures via ShadcnApp. Ideal for runtime theme switching (e.g., dark/light mode) without restarting the app, maintaining performance by limiting rebuild scope to theme-dependent widgets like GlowCard or Glass.

Parameters:

  • theme: The new ArcaneTheme instance to apply, overriding the current one.

Implementation

void setTheme(ArcaneTheme theme) {
  setState(() {
    _theme = theme;
    actionedAnnounce("Theme Changed");
  });
}