RaiiDisposeable.withLifecycle constructor
RaiiDisposeable.withLifecycle(
- RaiiLifecycleAware lifecycleAware, {
- required VoidCallback dispose,
- String? debugLabel,
Creates a RaiiDisposeable and attaches it to the provided lifecycleAware
.
The dispose
callback will be called during disposeLifecycle, ensuring
that the resource is properly cleaned up when the lifecycle ends.
Implementation
RaiiDisposeable.withLifecycle(
RaiiLifecycleAware lifecycleAware, {
required this.dispose,
this.debugLabel,
}) {
lifecycleAware.registerLifecycle(this);
}