flagLeak method
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)');
}
}