SubAutoClosable<Closable, SubClosable> class
abstract
represents pair of entities which should handled together to close them.
Good exaple is Listenable class from Flutter:
listenable.addListener(listener);
has corresponding closing method listenable.removeListener(listener);
With autoclosable lib it rewrites to listenable.addListenerWithCloser(closer, listener);
- Inheritance
-
- Object
- AutoClosable
- SubAutoClosable
- Annotations
-
- @immutable
Constructors
- SubAutoClosable(Closable closable, SubClosable subClosable, void onClose()?)
-
Creates a new instance of SubAutoClosable with the specified
closable
andsubClosable
entities, allowing them to be managed together for closure. You can also provide an optionalonClose
callback function to define custom actions to be executed when the SubAutoClosable is closed.
Properties
- closable → Closable
-
listenable.addListener(listener);
->closable.addListener(subClosable);
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
- subClosable → SubClosable
-
listenable.addListener(listener);
->closable.addListener(subClosable);
final
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