WillDisposeMixin mixin

A mixin that simplifies resource dispose for a class.

This allows you to mark resources for dispose at the time of their definition within the class, making your code more concise.

When the class's dispose method is called, the dispose method will be invoked on each resource wrapped with willDispose.

Superclass constraints
Mixin applications

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toDisposeResources Set<_ToDisposeResource>
The list of resources marked for dispose via willDispose.
no setter

Methods

dispose() FutureOr<void>
Override to define the dispose operation.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
willDispose<T>(T resource, {_OnBeforeCallback<T>? onBeforeDispose}) → T
Marks the resource for dispose.

Operators

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

Static Methods

hasValidDisposeMethod(dynamic resource) bool
Checks if resource has a dispose method that matches FutureOr<void> Function().