isWaitingForType<T> method
Return true if is waiting for ANY flag of the specific type.
This is useful when you want to wait for an Action to finish. For example:
class MyAction extends ReduxAction<AppState> {
Future<AppState?> reduce() async {
await doSomething();
return null;
}
void before() => dispatch(WaitAction.add(this));
void after() => dispatch(WaitAction.remove(this));
}
// Then, in some widget or connector:
if (wait.isWaitingForType<MyAction>()) { ... }
Implementation
bool isWaitingForType<T>() {
for (Object? flag in _flags.keys) if (flag is T) return true;
return false;
}