disposed library

Disposed library provides wrappers for automatic objects disposal utilizing Finalizer.

Using this package you can create object destructors.

Some catches:

Inner Disposable objects of DisposableContainer MUST not have strong references to parent container, failed to follow this rule will cause memory leak and object would not only be never disposed, but also remain in memory as long as program is running.

Classes

Disposable
Disposable interface.
DisposableContainer
Container that automatically disposes all objects in disposables list. Mentioned list is cached on moment of object creation, so if your disposables changes over time, override getter with a final field with modifiable list.
DisposableStreamController<T>
Disposable wrapper for StreamController that calls StreamController.close upon disposing.