shouldAbortMassEffect2 function

bool shouldAbortMassEffect2(
  1. Object? key,
  2. ContextWatchObservable observable1,
  3. ContextWatchObservable observable2, {
  4. required bool once,
  5. required bool immediate,
})

Implementation

bool shouldAbortMassEffect2(
  Object? key,
  ContextWatchObservable observable1,
  ContextWatchObservable observable2, {
  required bool once,
  required bool immediate,
}) {
  if (once || immediate) {
    final obs1Invoked = observable1.wasEffectInvoked(key!);
    final obs2Invoked = observable2.wasEffectInvoked(key);

    final isAnyInvoked = obs1Invoked || obs2Invoked;
    if (once && isAnyInvoked) {
      return true;
    }
    final isAnyNotInvoked = !obs1Invoked || !obs2Invoked;
    if (immediate && isAnyNotInvoked && isAnyInvoked) {
      return true;
    }
  }
  return false;
}