GameLauncher class final

Owns one game surface slot: who may open, who waits, and who supersedes. A live test replaces a visible game (the old one settles superseded); anything else while busy fails busy.

The watchdog runs only while the app is in the foreground — background timers pause, iOS wins — and only for entry and rewards opens. A direct game's coordinator already owns its timeout. Never throws.

Constructors

GameLauncher({MonotonicClock? clock, int watchdogMs = openWatchdogMs})

Properties

closeRequests → Stream<String>
Requested closes, by reason (superseded, cancelled, timeout). The host settles the matching open through its terminal callback. Never throws.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isBusy → bool
Whether a game route is on screen. A tap while busy fails busy.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
slot → GameLaunchSlot
no setter
visibleFlow → Stream<bool>
Fires true on commit and false on settle. Never throws.
no setter

Methods

markVisible() → void
The route committed: the game is on screen and the watchdog stops. Never throws.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open({required String key, bool liveTest = false, bool direct = false, void onTimeout(String reason)?}) → bool
Tries to take the slot for key. Returns true when the caller owns the open: free always, busy/visible only for a live test (which first asks the current game to close as superseded). A granted open arms the watchdog unless direct — the coordinator covers direct games. Never throws.
requestClose(String reason) → void
Asks the visible game to close with reason. A game that never committed still frees the slot. Never throws.
resetForTesting() → void
Test-only reset. Never throws.
setForeground(bool foreground) → void
The app entered (true) or left (false) the foreground. A backgrounded watchdog pauses with its remaining budget; foregrounding re-arms it. iOS wins: a game opened behind a lock screen is never failed for a skin that never got to run. Never throws.
settle([String reason = 'closed']) → void
The game settled for reason: the slot frees. Never throws.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited