isSync method
Returns true if the action is SYNC, and false if the action is ASYNC.
The action is considered SYNC if the before
method, the reduce
method,
and the wrapReduce
methods are all synchronous.
Implementation
bool isSync() {
//
/// Must check that it's NOT `Future<void> Function()`, as `void Function()` doesn't work.
bool beforeMethodIsSync = before is! Future<void> Function();
if (!beforeMethodIsSync) return false;
bool reduceMethodIsSync = reduce is St? Function();
if (!reduceMethodIsSync) return false;
// `wrapReduce` is sync if it's not overridden.
// `wrapReduce` is sync if it's overridden and SYNC.
// `wrapReduce` is NOT sync if it's overridden and ASYNC.
return (!ifWrapReduceOverridden_Async());
}