PlaySession class final

The one module that asks the server for a play chance. Pure apart from GameOutcomeSource and the identity provider: every choice is returned as a PlayDecision. Port of Android's PlaySession / iOS PlaySession.

Constructors

PlaySession(GameOutcomeSource _source, PlayIdentity? _identity())

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

admit({required String campaignKey, required bool direct, required bool testSend, required bool isGameBusy()}) → AdmitDecision
The one admission point for every play request. A non-direct trigger only renders a teaser, so only a direct trigger can be busy — and a live test never is, since its open replaces the visible game. On AdmitOpen the direct and per-campaign guards stay held until request's finally releases them, so an admitted request always pairs with exactly one release.
chanceState(String campaignKey, {String? testInvocationId, String? chanceId}) → Future<ChanceStateResult>
The backend state answer for one campaign key, about chanceId when given. Never throws.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request(PlayRequest request) → Future<PlayDecision>
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

decideAfterClose(ChanceStateResult state, [bool dismissAfterPlayed = true]) → CloseDecision
Maps a floating entry's state answer about its own chance after its game closed. playable keeps the entry with that chance; a failed call keeps the stored one, so a network blip never dismisses it; any other answer hides it. A played answer hides only when dismissAfterPlayed is true (the default): with it false the played entry stays, keeping its stored chance, so a tap reopens the skin showing the reward already won. expired/none/refused always hide: only the played case is gated by the flag. Inline entries never consult this flag. Port of Android/iOS PlaySession.decideAfterClose (floating-only).
decideTap({required bool gameVisible, bool isLiveTest = false, required ChanceGranted? chance}) → TapDecision
A tap opens the stored chance, unless a game is already showing. A live-test tap is not busy: the open replaces the visible game.
dropReasonFor(String? denyReason) → DropReason
The drop reason a refused chance settles as. Only the two denials that really are a cap (capReached, alreadyPlayed) read as frequency_capped; every other backend denyReason names what happened, and an unknown or missing one is not_eligible, never a cap. Spellings are the backend's DenyReason.
entryKey(CEPTriggerPayload payload) → String
The key an entry's chance and campaign are stored under: the live-test cep id for a live-test send, else the campaign key. A test send and the published campaign share a campaign key, so keying both by it would let one overwrite (or a hide wipe) the other's chance. Port of Android's and iOS's entryKey (kept here, with triggerIdOrNull, so tests can pin it without the SDK).
triggerIdOrNull(String presentationId, CEPTriggerPayload payload) → String?
The delivering presentation's id, so every presentation asks for its own chance. Routing passes presentationId in because the payload is only stamped at acceptance, after routing. Without one (a live test) it falls back to cepCampaignId. Null means there is none.

Constants

failBusy → const String
failDenied → const String
failInvalidResponse → const String
failMissingConfig → const String
failNetwork → const String
failNotShown → const String
failTimeout → const String
The grant transport timed out. Distinct from network: health keeps it as timeout, and the drop path reports it like a network failure.