settle method
Settles the presentation with its terminal outcome.
Takes effect exactly once — the first call wins and every later one is a silent no-op, which is what lets a watchdog and a real terminal path race without either needing to know about the other. Call this after the overlay has actually left the screen and the last signal was delivered: signals → overlay gone → outcome.
Implementation
void settle(PresentationOutcome outcome) {
if (isSettled) return;
assert(
outcome is! PresentationDismissed || _displayedEmitted,
'presentation $id settled dismissed(${outcome.reasonValue}) without ever '
'displaying — a presentation that never displayed must settle dropped',
);
// G8: the hold can never outlive the outcome. A modal experience never
// called releaseHold(), so this is where its CEP is unblocked.
_releaseHold();
_state = PresentationState.settled;
_listeners.clear();
// The terminal console line is *not* emitted here. It belongs to core's
// delivery observer, which is the one place that can also name the
// timeline stage a drop happened on — and putting it here as well would
// print the same fact twice on every single delivery.
_outcome.complete(outcome);
}