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
finallyreleases them, so an admitted request always pairs with exactly one release. -
chanceState(
String campaignKey, {String? testInvocationId, String? chanceId}) → Future< ChanceStateResult> -
The backend
stateanswer for one campaign key, aboutchanceIdwhen 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
stateanswer about its own chance after its game closed.playablekeeps the entry with that chance; a failed call keeps the stored one, so a network blip never dismisses it; any other answer hides it. Aplayedanswer hides only whendismissAfterPlayedis 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/refusedalways hide: only the played case is gated by the flag. Inline entries never consult this flag. Port of Android/iOSPlaySession.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 asfrequency_capped; every other backenddenyReasonnames what happened, and an unknown or missing one isnot_eligible, never a cap. Spellings are the backend'sDenyReason. -
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
hidewipe) the other's chance. Port of Android's and iOS'sentryKey(kept here, withtriggerIdOrNull, 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
presentationIdin because the payload is only stamped at acceptance, after routing. Without one (a live test) it falls back tocepCampaignId. 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 astimeout, and the drop path reports it like a network failure.