OnDispose class abstract
This class allows you to implement listeners notification when disposing object.
To notify listeners, create a dispose()
method in your class.
class Test with OnDispose {
// your class structure
@override
dispose() {
// dispose your class and call `super.dispose()` to notify listeners
super.dispose();
}
}
final Test test = Test();
test.onDispose.add(() => print('Object disposed'));
test.dispose();
Constructors
Properties
Methods
-
dispose(
) → void - Method that discards the object and notifies listeners
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyDispose(
) → void - Notify listeners with dispose of this object.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited