GameChanceStateCache class abstract final

The last terminal state answer per (campaign key, chance id), in memory only, so the next init can carry it as chanceState and the skin can skip its open-time state call.

The stored value is the server's data.response unchanged: the exact object the skin's own state bridge call resolves. Only played answers are kept: a cached playable goes stale the moment the chance is played through another surface (rewards page, another entry), and the next open would wrongly offer play again. A miss just costs one live call. Port of iOS GameChanceStateCache (Android ChanceStateCache).

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 Methods

clear() → void
Forgets every answer: a logout must not leak one user's state.
lookup(String campaignKey, String chanceId) → String?
The cached answer JSON for (campaignKey, chanceId), or null when no played answer was recorded for that chance. The host's init builder calls this when building GameInitPayload.chanceStateJson, so the skin can skip its open-time state call.
record(String campaignKey, Map<String, dynamic> response) → void
Records response (a data.response object) when it is a played answer for a chance, replacing any older one. playable answers are deliberately never cached: they stop being true the moment the chance is played elsewhere, and a stale one makes the next open offer play on an already-played chance. Anything else is ignored, never recorded.
recordEnvelope(String campaignKey, Object? envelope) → void
Records the data.response of a raw {isSuccess, data: {response}} envelope.