dvFallbackIsStale function
Whether the block a page was served with is no longer the page on screen.
The application routes on the client, so one navigation later the block in
the document describes the page the reader arrived on. Printing that is a
worse answer than printing nothing, and it is the kind that looks right:
the right title in the tab, somebody else's page on the paper. stamped
is what the build wrote on the block, current is where the reader is.
Nothing stamped means nothing to compare, and a block dropped on a guess is a page that stops printing for no reason.
Implementation
bool dvFallbackIsStale(String? stamped, String current) {
if (stamped == null || stamped.isEmpty) return false;
String trim(String path) {
final String trimmed = path.replaceAll(RegExp(r'/+$'), '');
return trimmed.isEmpty ? '/' : trimmed;
}
return trim(stamped) != trim(current);
}