disposedBy method
Adds this dispose scope to parentDisposeScope
.
It will be disposed when parentDisposeScope
is disposed.
Implementation
void disposedBy(DisposeScope parentDisposeScope) {
if (parentDisposeScope == this) {
throw StateError(
'''
Dispose scope cannot contain itself.
This is likely a mistake and you meant to call DisposeScope.dispose() instead.
''',
);
}
parentDisposeScope.addDispose(dispose);
}