shouldAbortMassEffect3 function

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

Implementation

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

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