addListener method

void addListener(
  1. Type t,
  2. NopListener listener,
  3. Object? groupName,
  4. int? position,
)

Implementation

void addListener(
    Type t, NopListener listener, Object? groupName, int? position) {
  assert(!containsKey(groupName, t), t);
  _groupPointers.putIfAbsent(groupName, () => {})[t] = listener;
  listener.onAddDependence(this);
  assert(() {
    position = position == null ? null : position! + 1;
    return true;
  }());
  assert(listener.length <= 1 ||
      Log.w('${listener.label} Add: ${listener.length}.',
          position: position ?? 0));
}