set static method

dynamic set(
  1. BuildContext context, {
  2. required ThemeData theme,
})

Changes the current theme to the new theme

Implementation

static set(BuildContext context, {required ThemeData theme}) async {
  CurrentTheme.instance.theme = theme;

  if (theme.brightness == Brightness.light) {
    AdaptiveTheme.of(context).setLight();
  } else if (theme.brightness == Brightness.dark) {
    AdaptiveTheme.of(context).setDark();
  } else {
    AdaptiveTheme.of(context).setSystem();
  }
}