updateAll method

void updateAll({
  1. List<String>? claims,
  2. List<MenuGroup>? menuGroups,
  3. List<ModuleMenu>? moduleMenuGroups,
  4. UserProfile? userProfile,
  5. List<Widget>? appBarActions,
  6. Widget? sidebarFooter,
  7. Widget? sidebarHeader,
  8. Widget? footer,
  9. Widget? drawerHeader,
  10. ChatbotConfig? chatbotConfig,
  11. String? title,
})

Atualiza múltiplas propriedades de uma vez e notifica os listeners.

Use este método quando precisar atualizar várias propriedades simultaneamente, evitando múltiplas notificações.

controller.updateAll(
  claims: newClaims,
  menuGroups: newMenuGroups,
  userProfile: newUserProfile,
);

Implementation

void updateAll({
  List<String>? claims,
  List<MenuGroup>? menuGroups,
  List<ModuleMenu>? moduleMenuGroups,
  UserProfile? userProfile,
  List<Widget>? appBarActions,
  Widget? sidebarFooter,
  Widget? sidebarHeader,
  Widget? footer,
  Widget? drawerHeader,
  ChatbotConfig? chatbotConfig,
  Widget? logo,
  String? title,
}) {
  bool hasChanges = false;

  if (claims != null) {
    _claims = claims;
    hasChanges = true;
  }
  if (menuGroups != null) {
    _menuGroups = menuGroups;
    hasChanges = true;
  }
  if (moduleMenuGroups != null) {
    _moduleMenuGroups = moduleMenuGroups;
    hasChanges = true;
  }
  if (userProfile != null) {
    _userProfile = userProfile;
    hasChanges = true;
  }
  if (appBarActions != null) {
    _appBarActions = appBarActions;
    hasChanges = true;
  }
  if (sidebarFooter != null) {
    _sidebarFooter = sidebarFooter;
    hasChanges = true;
  }
  if (sidebarHeader != null) {
    _sidebarHeader = sidebarHeader;
    hasChanges = true;
  }
  if (footer != null) {
    _footer = footer;
    hasChanges = true;
  }
  if (drawerHeader != null) {
    _drawerHeader = drawerHeader;
    hasChanges = true;
  }
  if (chatbotConfig != null) {
    _chatbotConfig = chatbotConfig;
    hasChanges = true;
  }
  if (logo != null) {
    _logo = logo;
    hasChanges = true;
  }
  if (title != null) {
    _title = title;
    hasChanges = true;
  }

  if (hasChanges) {
    notifyListeners();
  }
}