addWatchObject method

dynamic addWatchObject(
  1. Object obj,
  2. String group
)

group 认为可以在一块释放的对象组,一般在一个State中想监听的对象

Implementation

addWatchObject(Object obj, String group) {
  if (LeakDetector.maxRetainingPath == null) return;

  _onEventStreamController
      .add(DetectorEvent(DetectorEventType.addObject, data: group));

  _checkType(obj);
  String key = group;
  Expando? expando = _watchGroup[key];
  expando ??= Expando('LeakChecker$key');
  expando[obj] = true;
  _watchGroup[key] = expando;
}