UserPrefsDatasource class
Thin wrapper around SharedPreferences for non-secret, device-local user prefs. Use flutter_secure_storage for anything sensitive (API keys, auth tokens). This class is safe to instantiate multiple times — all instances talk to the same underlying storage.
Constructors
- UserPrefsDatasource({SharedPreferences? prefs})
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
-
clearHomeCache(
) → Future< void> - Clears all home first-paint cache entries. Called on sign-out so the next user doesn't see the previous user's streak / domain list flash before their own data loads.
-
getCachedDomains(
) → Future< List< CachedDomain> > -
Cached projection of
`MyCurriculumDomains`— id/name/slug only, capped to keep the blob tiny. Reads return an empty list if missing or stale. -
getCachedDueCount(
) → Future< int?> -
getCachedStreak(
) → Future< int?> -
getLastActiveOrgId(
) → Future< String?> -
getLastUsedMode(
) → Future< String> -
Returns
'personal'or'org'. Defaults to'personal'when unset. -
getMasteryIntroSeen(
) → Future< bool> -
One-time flag for the mastery-ladder intro banner shown at the top of
TopicTreeScreen. The banner replaces the standalone
/onboarding/masteryscreen — the explanation only surfaces when the user actually opens a domain's topic tree and goes away after dismissal. -
getReviewIntroSeen(
) → Future< bool> -
One-time flag for the spaced-repetition intro banner shown at the top
of ReviewSessionScreen. The banner replaces the standalone
/onboarding/reviewscreen — the explanation only surfaces when the user actually lands in the review flow and goes away forever after they dismiss it. -
getThemeMode(
) → Future< ThemeMode> -
User-selected theme. Defaults to ThemeMode.system when unset or when
the stored value isn't a recognised
ThemeMode.name(e.g. corruption). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCachedDomains(
List< CachedDomain> domains) → Future<void> -
setCachedDueCount(
int value) → Future< void> -
setCachedStreak(
int value) → Future< void> -
setLastActiveOrgId(
String orgId) → Future< void> -
setLastUsedMode(
String mode) → Future< void> -
setMasteryIntroSeen(
bool seen) → Future< void> -
setReviewIntroSeen(
bool seen) → Future< void> -
setThemeMode(
ThemeMode mode) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- homeCacheMaxAge → const Duration