SingleAutoClosable<T> class
abstract
Represents entities which able to (and should be) close This class descendant designed for the simple case of a single entity
- Inheritance
-
- Object
- AutoClosable
- SingleAutoClosable
- Annotations
-
- @immutable
Constructors
- SingleAutoClosable(T closable, void onClose()?)
- Creates an SingleAutoClosable instance to manage the termination and cleanup of a specified closable entity.
Properties
- closable → T
-
The closable entity that this SingleAutoClosable instance is associated with.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isClosed → bool?
-
Whether the object is already closed.
null
means you can't extract such information. For example: Flutter's ChangeNotifier doesn't tell you if he was disposedno setterinherited - onClose → void Function()?
-
A callback function that can be provided to perform custom actions when
the associated entity is closed. This function is executed after close
is called. If close is Future, then it will be awaited and called onClose.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → FutureOr< void> -
Closes the current instance.
The returned future completes when the instance has been closed.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator.
override