update method
- WidgetState state,
- bool add
Adds state to value if add is true, and removes it otherwise,
and notifies listeners if value has changed.
Implementation
void update(WidgetState state, bool add) {
final bool valueChanged = add ? value.add(state) : value.remove(state);
if (valueChanged) {
notifyListeners();
}
}