Disposable class abstract interface

Released automatically when the scope that created it ends.

A request-scoped dependency registered with DI.registerRequestScoped is disposed once its request finishes, whether it succeeded or threw. Use it for anything holding a resource for the length of one request — a database transaction, a batched writer, an open file.

Disposal happens in reverse creation order, so a dependency can rely on whatever it was built from still being alive. Errors thrown here are logged and do not fail the response, which has already been sent.

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() FutureOr<void>
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