update method

void update(
  1. Map<WidgetEvent, bool> registry, {
  2. bool forceNotify = false,
})

Updates the value set with a map of WidgetEvents and their desired states.

Events with a value of true in the map will be marked as active, while events with a value of false will be removed from the set.

Implementation

void update(
  Map<WidgetEvent, bool> registry, {
  bool forceNotify = false,
}) {
  int affected = 0;
  registry.forEach((event, active) {
    if (active) {
      if (value.add(event)) affected++;
    } else {
      if (value.remove(event)) affected++;
    }
  });
  if (affected > 0 || forceNotify) notifyListeners();
}