dispatchObjectCreated static method

void dispatchObjectCreated({
  1. required String library,
  2. required String className,
  3. required Object object,
  4. Map<String, dynamic>? context,
})

Dispatches object creation to the leak_tracker.

Use context to provide additional information, that may help in leak troubleshooting. The value must be serializable.

Noop if object creation is already dispatched.

Implementation

static void dispatchObjectCreated({
  required String library,
  required String className,
  required Object object,
  Map<String, dynamic>? context,
}) {
  assert(() {
    _baseliner?.takeSample();
    if (phase.ignoredLeaks.isIgnored(className)) return true;
    _leakTracker?.objectTracker.startTracking(
      object,
      context: context,
      trackedClass:
          fullClassName(library: library, shortClassName: className),
      phase: _phase.value,
    );

    return true;
  }());
}