DailyQuestService class
Caller-declared daily/weekly quest tracker — the third reset-cadence
mechanism alongside AchievementService (permanent, never resets) and
DailyLoginService (fixed login-streak calendar, not arbitrary
objectives). Quests ("win 3 matches", "use 1 booster") are declared up
front via register (id, target, reset period), same "caller owns the
declaration, service only tracks progress" convention as
AchievementService.register.
Reset is driven entirely by todayEpochDayClamped (see
utils/clamped_clock.dart) so winding the device clock back can't be
used to re-claim an already-claimed quest early.
- Inheritance
-
- Object
- GetLifeCycle
- DisposableInterface
- GetxService
- DailyQuestService
Constructors
- DailyQuestService({String? storageKey})
Properties
-
debugPendingSaves
→ Future<
void> -
Awaits every save queued so far — lets a test deterministically wait
for a burst of rapid calls to fully settle instead of guessing a
delay.
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
-
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
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
$configureLifeCycle(
) → void -
inherited
-
claim(
String questId) → bool -
Claims
questId's reward for the current period. Returnstrueonly if this call actually claimed it (was completed and not already claimed this period) —falsefor an unregistered id, an incomplete quest, or one already claimed this period. Never throws. -
incrementProgress(
String questId, int amount) → void -
Adds
amounttoquestId's progress for the current period — rebasing to0first if the stored record belongs to a period that has since rolled over. Safe to call after the quest is already completed: progress keeps accumulating, isCompleted staystrue, never throws or "un-claims". -
isClaimed(
String questId) → bool -
trueifquestId's reward was already claimed for the current period.false(never throws) for an id that was never registered or whose stored claim belongs to a rolled-over period. -
isCompleted(
String questId) → bool -
trueonce progressOf reaches the registered target for the current period.false(never throws) for an id that was never registered. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onClose(
) → void -
Called before
onDeletemethod.onClosemight 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
-
progressOf(
String questId) → int -
Current progress toward
questId's target,0if never registered or if the stored progress belongs to a period that has since rolled over (never throws). -
progressRatio(
String questId) → double -
progressOf(id) / targetOf(id)clamped to[0.0, 1.0]—0.0(never throws) ifquestIdwas never registered or has no progress yet. Same pattern asAchievementService.progressRatio(ENH-74). -
register(
String questId, int targetCount, {QuestPeriod period = QuestPeriod.daily}) → void -
Declares
questId'stargetCountand resetperiodup front. Safe to call again for the same id (e.g. re-declared every app boot) — only updates the declaration, never touches stored progress. -
targetOf(
String questId) → int? -
questId's registered target count, ornullif never registered. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- maybe → DailyQuestService?
-
Gets the instance if already registered (safe to call from
game/widget tests).
no setter