SpotDisposable class abstract
Interface for objects that require cleanup when disposed.
Implement this interface for services that need to release resources such as database connections, HTTP clients, file handles, or subscriptions.
When a singleton service implementing SpotDisposable is disposed via Spot.dispose or Spot.disposeAll, its dispose method will be automatically called before the instance is cleared from the registry.
Example:
class ApiClient implements Disposable {
final Dio dio;
ApiClient(this.dio);
@override
void dispose() {
dio.close();
print('ApiClient cleaned up');
}
}
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 - Release resources held by this object.
-
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