collectLeaks static method

Future<Leaks> collectLeaks()

Returns details of the leaks collected since last invocation.

The same object may be reported as leaked twice: first as non GCed, and then as GCed late.

Should be invoked before stop to obtain the leaks.

Implementation

static Future<Leaks> collectLeaks() async {
  Future<Leaks>? result;

  assert(() {
    result = _leakTracker?.objectTracker.collectLeaks();
    return true;
  }());

  return await (result ?? Future.value(Leaks({})));
}