update method

void update(
  1. [List<String> ids,
  2. bool condition = true]
)

Rebuilds GetBuilder each time you call update(); Can take a List of ids, that will only update the matching GetBuilder( id: ), ids can be reused among GetBuilders like group tags. The update will only notify the Widgets, if condition is true.

Implementation

void update([List<String> ids, bool condition = true]) {
  if (!condition) {
    return;
  }
  if (ids == null) {
//      _updaters?.forEach((rs) => rs(() {})); //<old>
    for (final updater in _updaters) {
      updater();
    }
  } else {
    // @jonny, remove this commented code if it's not more optimized.
//      for (final id in ids) {
//        if (_updatersIds[id] != null) _updatersIds[id]();
//        if (_updatersGroupIds[id] != null)
//          for (final rs in _updatersGroupIds[id]) rs();
//      }

    for (final id in ids) {
      _updatersIds[id]?.call();
      // ignore: avoid_function_literals_in_foreach_calls
      _updatersGroupIds[id]?.forEach((rs) => rs());
    }
  }
}