Closeable mixin

Similar to java Closeable, or python context manager, or c# IDisposable

NOTE: Default constructor cannot be const, because we cannot have canonicalized objects

Available extensions

Properties

closeables Iterable<Closeable>
Inner closeables. If this resource manages other closeables, they should be returned here, so they can be closed when this resource is closed. If there are no inner closeables, return empty iterable
no setter
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether this resource has been closed
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() FutureOr<void>
Closes this resource, relinquishing any underlying resources. Do not close manually. Use runAndClose, runAndCloseAsync, or useCloseable, useCloseableAsync functions instead
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runAndClose<R>(R fn(C p0)) → R

Available on C, provided by the CloseableExtensions extension

Runs passed function and closes this resource after it Closes the resource even if the function throws. The first exception thrown is propagated, if both the function and the close throw, the exception from the function is propagated
runAndCloseAsync<R>(FutureOr<R> fn(C p0)) Future<R>

Available on C, provided by the CloseableExtensions extension

Runs passed function and closes this resource after it Closes the resource even if the function throws. The first exception thrown is propagated, if both the function and the close throw, the exception from the function is propagated
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited