onClose method
Called when the object is removed from the scope or the scope is disposed.
Use this method to release resources, close streams, or cancel timers.
Implementation
@override
@mustCallSuper
FutureOr<void> onClose() {
return _resourceCloseFuture ??= _closeOwnedResources();
}