WaitAction<St>.add constructor

WaitAction<St>.add(
  1. Object? flag,
  2. {Object? ref,
  3. Duration? delay}
)

Adds a flag that indicates some process is currently running. Optionally, you can also have a flag-reference called ref.

Note: flag and ref must be immutable objects.

// Add a wait state, using this as the flag.
dispatch(WaitAction.add(this));

// Add a wait state, using this as the flag, and 123 as a reference.
dispatch(WaitAction.add(this, ref: 123));

Note: When the process finishes running, you will have to remove the flag by using the remove or clear methods.

If you pass a delay, the flag will be added only after that duration has passed, after the add method is called.

Implementation

WaitAction.add(
  this.flag, {
  this.ref,
  this.delay,
}) : operation = WaitOperation.add;