Disposable class abstract
Something disposable.
Use disposeObject to mark object as disposed. Use checkObjectDisposed as guard to throw if object was disposed.
Usage:
class Controller extends Disposable {
@override
void dispose() {
// Do with assert or without.
assert(Disposable.checkObjectDisposed(this));
// Dispose underlying resources.
super.dispose();
}
}
or
class Controller implements Disposable {
@override
void dispose() {
Disposable.checkObjectDisposed();
// Dispose underlying resources.
Disposable.disposeObject(this);
}
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Should dispose this using Disposable.disposeObject.
-
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 ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
checkObjectDisposed(
Disposable disposable, [String? methodName]) → bool -
It throws DisposedException if
disposablewas disposed. -
disposeObject(
Disposable disposable) → void -
Marks a
disposableas disposed. -
isDisposed(
Disposable disposable) → bool -
Whether a
disposableis disposed.