registerDismissCallback method
Registers a dismiss callback for a specific page.
The callback can veto a dismiss while the page is on top. At the root
(a lone page in single-stack mode) the return value is ignored; call
SystemNavigator.pop() to exit.
Implementation
void registerDismissCallback(
ValueKey<String> pageKey,
bool Function() callback,
) {
_dismissCallbacks[pageKey] = callback;
}