run method
Implementation
Future<void> run() async {
lines.clear();
initParams();
if (_invalid()) return;
wap.wapHasMore = await fetchFirst();
if (!wap.wapHasMore) return;
_cacheInit();
wap.wapBlockId = 'PREFIX';
wap.wapEnable = true;
parseBlock('PREFIX');
_newPageStart();
while (wap.wapHasMore) {
_checkHdrs();
if (wap.wapChgFound) {
await onGroupPrepare(); // @@@ On a group break, first (async) open the <dbquery> the group needs
_emitHdrs();
}
wap.wapBlockId = 'RECORD';
wap.wapEnable = true;
parseBlock('RECORD');
_hadRecordThisPage = true; // @@@ this page now has a detail row
wap.wapHasMore = await fetchNext();
if (wap.wapHasMore) {
if (_checkFtrs()) {
await fetchPrior();
_emitFtrs();
wap.wapHasMore = await fetchNext();
}
}
// aa ### flutter extension
// There used to be a "check for a page break only after printing a
// whole record" check here:
// if (wapHasMore && wapLineNo >= wapLpp) { close out the page → page break }
// This has been removed — page breaks are now decided by
// emitRow() on "every single line printed" instead.
// Reason: a sub-report's rows (device="sub") also belong to the
// main report's page flow, and can be nested multiple
// levels deep; checking only at the outermost level means
// a single main record dragging along N levels of
// sub-reports could blow the layout apart.
// zz ### flutter extension
}
_flushLastFtrs();
_emitFtrs();
_newPageEnd();
wap.wapBlockId = 'SUFFIX';
wap.wapEnable = false;
parseBlock('SUFFIX');
}