startAsync method
Delays for delay and then calls finishAsyncWithResponse with null as the value.
There is no way to execute code during the startAsync function by design, the whole point of a deferred query is to execute some code after a delay. In addition, any calculations done at the beginning might be based on an obsolete state by the time onResponse gets called. Instead, you want to do your calculations on the state you are handed on finishAsyncExecute
Implementation
@override
void startAsync(AFStartQueryContext<AFUnused> context) {
if(executeImmediately) {
AFibD.logQueryAF?.d("Executing immediately for deferred query $this");
context.onSuccess(AFUnused.unused);
}
timer = Timer.periodic(delay, (_) {
AFibD.logQueryAF?.d("Executing finishAsyncExecute for deferred query $this");
context.onSuccess(AFUnused.unused);
});
}