dispose method
Dispose this object and clean up its resources.
This method should be idempotent - calling it multiple times should be safe and not cause errors. After disposal, the object should not be used for any operations.
Returns: A Future that completes when cleanup is finished, or completes synchronously if no async operations are needed.
Implementation Guidelines:
- Always check if already disposed before doing work
- Clean up in reverse order of initialization when possible
- Handle exceptions gracefully to prevent partial cleanup
- Set disposed flag to prevent further use
Implementation
@override
FutureOr<void> dispose() {
disposeNode(this);
}