PrestigeService class

The classic idle/incremental-game "prestige"/"ascension" loop (Cookie Clicker, Adventure Capitalist, ...): once primaryCurrency reaches prestigeThreshold, the player can soft-reset softResetCurrencies (wiped back to 0) in exchange for relicsPerPrestige of metaCurrency — a currency that's NEVER soft-reset, and permanently raises currentMultiplier via prestigeMultiplier (economy_math.dart, the pure formula this and tool/economy_sim.dart's balancing simulator both call, so they can't silently drift apart).

Built entirely on EconomyWallet's existing balanceOf/earn/ trySpend — no separate storage of its own, no new persistence format to keep in sync: relics (and every soft-reset currency) already persist exactly like any other wallet balance.

currentMultiplier is a pure read — applying it to OfflineProgressionService/EnergyService's own rate/interval parameters is the CALLER's job (both take a caller-supplied rate rather than deriving one themselves, so there's no coupling to introduce here — see example/'s Cookbook demo for the integration).

Inheritance
  • Object
  • GetLifeCycle
  • DisposableInterface
  • GetxService
  • PrestigeService

Constructors

PrestigeService({required EconomyWallet wallet, String primaryCurrency = 'coins', String metaCurrency = 'relics', int prestigeThreshold = 1000, double bonusPerRelic = 0.1, int relicsPerPrestige = 1, Set<String> softResetCurrencies = const {'coins'}})

Properties

bonusPerRelic → double
Multiplier bonus each unit of metaCurrency grants — see prestigeMultiplier.
final
currentMultiplier → double
The permanent earn-rate multiplier currently in effect, derived from metaCurrency's current balance — 1 if the player has never prestiged (0 relics).
no setter
hashCode → int
The hash code for this object.
no setterinherited
initialized → bool
Checks whether the controller has already been initialized.
no setterinherited
isClosed → bool
Checks whether the controller has already been closed.
no setterinherited
metaCurrency → String
The permanent currency prestige grants — never soft-reset, and the only input to currentMultiplier.
final
onDelete → InternalFinalCallback<void>
Internal callback that starts the cycle of this controller.
finalinherited
onStart → InternalFinalCallback<void>
Called at the exact moment the widget is allocated in memory. It uses an internal "callable" type, to avoid any @overrides in subclases. This method should be internal and is required to define the lifetime cycle of the subclass.
finalinherited
prestigeThreshold → int
Minimum primaryCurrency balance required to prestige.
final
primaryCurrency → String
The currency canPrestige/prestige check against prestigeThreshold.
final
relicsPerPrestige → int
How much metaCurrency one prestige call grants.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
softResetCurrencies → Set<String>
Currencies wiped to 0 by prestige — metaCurrency can never be one of these (enforced by the constructor's assert).
final
wallet → EconomyWallet
final

Methods

$configureLifeCycle() → void
inherited
canPrestige() → bool
Whether primaryCurrency's current balance meets prestigeThreshold.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClose() → void
Called before onDelete method. onClose might be used to dispose resources used by the controller. Like closing events, or streams before the controller is destroyed. Or dispose objects that can potentially create some memory leaks, like TextEditingControllers, AnimationControllers. Might be useful as well to persist some data on disk.
inherited
onInit() → void
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
inherited
onReady() → void
Called 1 frame after onInit(). It is the perfect place to enter navigation events, like snackbar, dialogs, or a new route, or async request.
inherited
prestige() → Future<SdkResult<int>>
Soft-resets every currency in softResetCurrencies to 0, then grants relicsPerPrestige of metaCurrency — returns the new metaCurrency balance on success. Fails with SdkErrorKind.validation (no state change at all) if canPrestige is false.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

maybe → PrestigeService?
Gets the instance if already registered (safe to call from game/widget tests).
no setter