toggleWaitStateFlagIndicator function

void toggleWaitStateFlagIndicator({
  1. required BuildContext context,
  2. required String flag,
  3. bool show = true,
})

toggleWaitStateFlagIndicator a generic function that call WaitAction to add or remove a flag. When show is true, the flag will be removed.

Implementation

void toggleWaitStateFlagIndicator(
    {required BuildContext context, required String flag, bool show = true}) {
  show
      ? StoreProvider.dispatch<CoreState>(
          context,
          WaitAction<CoreState>.add(flag, ref: '${flag}_ref'),
        )
      : StoreProvider.dispatch<CoreState>(
          context,
          WaitAction<CoreState>.remove(flag, ref: '${flag}_ref'),
        );
}