forget static method
Implementation
static void forget(DVWindow window) {
final bool wasMain = identical(_main.value, window);
_windows.remove(window);
_kioskOwners.removeWhere((String _, DVWindow w) => identical(w, window));
window.kiosk?._runtime.stop();
_all.value = List<DVWindow>.unmodifiable(_windows);
// Promotion before the exit decision: under exit: mainWindow the answer
// depends on whether the window that closed was main, and after promotion
// it no longer is.
if (wasMain) _promoteMain();
final bool exits = switch (exitPolicy) {
DVWindowExitPolicy.explicit => false,
DVWindowExitPolicy.mainWindow => wasMain,
DVWindowExitPolicy.lastWindow =>
!_windows.any((DVWindow w) => w.kind.countsAsPrincipal),
};
// Latched, not recomputed. Under mainWindow, closing main decides the
// process should end, and a stray window closing afterwards would compute
// false and cancel an exit the embedder had not got round to acting on --
// so nothing would ever exit. Only opening a window clears it, because
// then there is something on screen again.
if (exits) _shouldExit.value = true;
}