flagLeak method

  1. @mustCallSuper
  2. @override
void flagLeak([
  1. String? description
])
inherited

Flag the object as having been disposed in a way that allows easier profiling.

The leak flag is only set after disposal, so most instances found in a heap snapshot will indicate memory leaks.

Consumers can search a heap snapshot for the LeakFlag class to see all instances of the flag.

Implementation

@mustCallSuper
@override
void flagLeak([String? description]) {
  if (_debugMode && _leakFlag == null) {
    _leakFlag = LeakFlag(
        description ?? '$disposableTypeName (runtimeType: $runtimeType)');
  }
}