GameSurface class abstract final

The one open path for every game: direct, entry and rewards games.

Owns, in this order, for every open: the busy check, the SDK-version check, the skin cache-or-download, the client/user check, the presentation-alive check, the single GameOpenRequest build, and the policy-wired handoff to the route. Mirrors iOS GameSurface and Android GameSurface.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

activeRoute → ValueNotifier<Route<void>?>
The game route while it is on screen, null otherwise.
final
busyListenable → ValueNotifier<bool>
Changes when a game route opens or closes. The floaters listen so none is drawn over the game: the host's overlay entries sit above every route pushed after them.
no setter
isBusy → bool
Whether a game route is on screen. A tap while busy fails busy.
no setter

Static Methods

dismissReason(String closeReason) → String
The CEP reason for a direct game's close. The native close button, the system back and the skin's own close are the user's; a CTA handoff is a CTA; anything else is a cancel. Matches Android's dismissReasonOf.
dismissSuperseded(NavigatorState? navigator) → Future<void>
Closes the loading or visible game as superseded: a rewards page or a live-test open replaces it. Best-effort: pops the top route only while a game route holds the surface. Never throws. Port of Android's GameLauncher.replaceVisible(GameSurface.CLOSE_SUPERSEDED) and iOS's GamePresenter.dismiss(reason: "superseded").
entryValueOf(GameSettle settle) → String
The funnel entry origin: direct, inlineTeaser, floating or rewards. Carried on every funnel and health event.
fail({required GameSettle settle, required CampaignModel campaign, required GamificationConfig config, required String reason, required String chanceId, required void reportOpenFailed(GameOpenFailedEvent event, CEPTriggerPayload payload), required void settleDirectFailure(CEPTriggerPayload payload, String reason), String stage = ''}) → void
The failure path for a game that never displayed. A client failure reports game_open_failed; busy is not a failure, so it reports nothing. A direct game also settles its presentation with the real reason — never a toast — and an entry's teaser stays. Matches Android.
gameDismissReason(String closeReason) → String
The dismiss_reason analytics value for a game close. Every settled reason passes through; the bare close button and back read user; anything unknown reads cancelled. Matches Android's gameDismissReasonOf.
makeGameOpenRequest({required String entryHtml, required String chanceId, required GamificationConfig config, required CampaignModel campaign, required CEPTriggerPayload payload, required String userId, required GameSettle settle, String projectId = '', String? themeFontFamily, bool warm = false, String tier = '', GameOpenTiming? timing, void reportViewed(GameViewedEvent event, CEPTriggerPayload payload)?, void reportClicked(GameClickedEvent event, CEPTriggerPayload payload)?, void reportDismissed(GameDismissedEvent event, CEPTriggerPayload payload)?, void reportOpenFailed(GameOpenFailedEvent event, CEPTriggerPayload payload)?, void reportCepImpressed(CEPTriggerPayload payload)?, void reportCepClicked(CEPTriggerPayload payload, String elementId)?, void reportCepDismissed(CEPTriggerPayload payload, String elementId)?, void settleDirectFailure(CEPTriggerPayload payload, String elementId)?, void reportChanceEvents(List<ChanceAnalyticsEvent> events, CEPTriggerPayload payload)?}) → GameOpenRequest
open({required CampaignModel campaign, required GamificationConfig config, required String chanceId, required GameSettle settle, required NavigatorState? navigator, required String? userId, required String? deviceId, required String projectId, required String? themeFontFamilyOf()?, required Future<String?> loadSkinHtml(GamificationConfig config), required Future<String?> downloadSkin(GamificationConfig config), required Future<void> present(GameOpenRequest request), required void reportOpenFailed(GameOpenFailedEvent event, CEPTriggerPayload payload), required void settleDirectFailure(CEPTriggerPayload payload, String reason), void reportViewed(GameViewedEvent event, CEPTriggerPayload payload)?, void reportClicked(GameClickedEvent event, CEPTriggerPayload payload)?, void reportDismissed(GameDismissedEvent event, CEPTriggerPayload payload)?, void reportCepImpressed(CEPTriggerPayload payload)?, void reportCepClicked(CEPTriggerPayload payload, String elementId)?, void reportCepDismissed(CEPTriggerPayload payload, String elementId)?, void reportChanceEvents(List<ChanceAnalyticsEvent> events, CEPTriggerPayload payload)?, bool isPresentationAlive()?, GameOpenTiming? timing, String tierOf()?}) → Future<void>
The full open, as in iOS GameSurface.open: the busy check, the rewards-only SDK recheck, the skin cache-or-download, the user id check, the presentation-alive check, the single request build, and the handoff. Every former open path (direct, entry tap, rewards chance) funnels through here. Never throws.
openRoute({required NavigatorState navigator, required GameWebViewHost host, Object? routeKey}) → Future<bool>
Opens host modally on navigator as a transparent full-screen route. The route is transparent so touches pass through until the skin is ready; back always closes. Returns false when busy. Never throws.
payloadOf(GameSettle settle, CampaignModel campaign) → CEPTriggerPayload
resetForTesting() → void
Test-only reset for the busy flag.
rewardsPayload({required String chanceId, required CampaignModel campaign}) → CEPTriggerPayload
The rewards widget has no CEP presentation, so it opens with a synthetic payload: rewards:<chanceId> — impressions dedup by cepCampaignId, so reusing the campaign id would swallow repeat plays.
storageIdentity({required String? userId, String? deviceId}) → String
The bridge storage identity for one open: the user id, or the device id when there is no user — Android's userId ?: deviceId. Pure, so the shared case-table run pins the choice without a game.