Effect.withCleanup constructor
Effect.withCleanup(
- void fn(
- void (
- void ()
- void (
Creates an effect that can register cleanup callbacks for each run.
Registered callbacks run before the next execution and when the effect is disposed. This is useful for timers, stream subscriptions, and listeners.
Implementation
Effect.withCleanup(void Function(void Function(void Function())) fn)
: _fn = null,
_cleanupFn = fn {
run();
}