onEffectCleanup function

void onEffectCleanup(
  1. void callback(), {
  2. bool failSilently = false,
})

Implementation

void onEffectCleanup(void Function() callback, {bool failSilently = false}) {
  final sub = alien.getActiveSub();
  if (sub is _OrefEffect) {
    sub.cleanup = callback;
  } else if (!failSilently) {
    warn(
      '`onEffectCleanup()` was called when there was no active effect to assign the callback to.',
    );
  }
}