shouldAbortMassEffect4 function

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

Implementation

bool shouldAbortMassEffect4(
  Object? key,
  ContextWatchObservable observable1,
  ContextWatchObservable observable2,
  ContextWatchObservable observable3,
  ContextWatchObservable observable4, {
  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 obs4Invoked = observable4.wasEffectInvoked(key);

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