Wait class
Immutable object to keep track of boolean flags that indicate if some process is in progress (the user is "waiting").
The flags and flag-references can be any immutable object. They must be immutable to make sure Wait is also immutable.
Use it in Redux store states, like this:
- To add a flag: state.copy(wait: state.wait.add(flag: myFlag));
- To remove a flag: state.copy(wait: state.wait.remove(flag: myFlag));
- To clear all flags: state.copy(wait: state.wait.clear());
If can also use have a flag with a reference, like this:
- To add a flag with reference: state.copy(wait: state.wait.add(flag: myFlag, ref:MyRef));
- To remove a flag with reference: state.copy(wait: state.wait.remove(flag: myFlag, ref:MyRef));
- To clear all references for a flag: state.copy(wait: state.wait.clear(flag: myFlag));
In the ViewModel, you can check the flags/references, like this:
- To check if there is any waiting: state.wait.isWaiting
- To check if a specific flag is waiting: state.wait.isWaitingFor(myFlag);
- To check if a specific flag/reference is waiting: state.wait.isWaitingFor(myFlag, ref: myRef);
- Annotations
Constructors
- Wait()
-
factory
Properties
Methods
-
add(
{required Object? flag, Object? ref}) → Wait -
clear(
{Object? flag}) → Wait -
clearWhere(
bool test(Object? flag, Set< Object?> refs)) → void -
isWaitingFor(
Object? flag, {Object? ref}) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
process(
WaitOperation operation, {required Object? flag, Object? ref}) → Wait -
remove(
{required Object? flag, Object? ref}) → Wait -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- ALL → const Object
-
Convenience flag that you can use when a
null
value means ALL. For example, suppose if you want until an async process schedules anappointment
for specifictime
. However, if no time is selected, you want to schedule the whole day (all "times"). You can do:dispatch(WaitAction.add(appointment, ref: time ?? Wait.ALL));
- empty → const Wait