setSetting method

dynamic setSetting(
  1. Map<String, Object?> setting
)

Sets application-specific settings for the request.

If the theme cookie is present, it updates the theme setting accordingly.

Implementation

setSetting(Map<String, Object?> setting) {
  ///To change theme when Cookie of theme is seted.
  var theme = getCookie(
    'theme',
    def: (setting['theme'] ?? 'light').toString(),
    safe: false,
  );
  if (['light', 'dark'].contains(theme)) {
    setting['theme'] = theme;
  }

  _setting = {
    ...setting,
  };
}