RaiiDisposeable.withLifecycle constructor

RaiiDisposeable.withLifecycle(
  1. RaiiLifecycleAware lifecycleAware, {
  2. required VoidCallback dispose,
  3. 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);
}