UserPreferences class

Inheritance
Available extensions

Properties

activeAttributeGroup → String
no setter
appLanguageCode → String?
Please use ProductQuery.getLanguage as interface
no setter
appLaunches → int
no setter
crashReports → bool
no setter
currentColor → String
no setter
currentContrastLevel → String
no setter
currentTheme → String
no setter
devMode → int
no setter
donationAsksMutedUntil → DateTime?
no setter
donationStripHiddenUntil → DateTime?
no setter
forMeAttributesFilterType → ForMeAttributesFilterType?
no setter
hapticFeedbackEnabled → bool
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
inAppReviewAlreadyAsked → bool
no setter
languagesUsage → Map<String, int>
no setter
lastCountedBarcode → String?
no setter
lastReminderShownAt → DateTime?
no setter
lastVisitedOnboardingPage → OnboardingPage
no setter
latestProductType ↔ ProductType
getter/setter pair
numberOfScans → int
no setter
onAnalyticsChanged ↔ ValueNotifier<bool>
getter/setter pair
onCrashReportingChanged ↔ ValueNotifier<bool>
getter/setter pair
playCameraSound → bool
no setter
productPageActions → List<ProductFooterActionBar>
no setter
productPageTabs → List<String>
no setter
productsLookedUpSinceAsk → int
no setter
readyForPriceTagValidation → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shouldShowFolksonomyExplanationCard → bool
no setter
shouldShowPricesExplanationCard → bool
no setter
shouldShowPricesFeedbackForm → bool
no setter
taglineFeedClickedNews → List<String>
no setter
taglineFeedDisplayedNews → List<String>
no setter
taglineFeedSessionClicks → Set<String>
final
taglineFeedSessionImpressions → Set<String>
final
useFlashWithCamera → bool
no setter
userCountryCode → String?
no setter
userCurrencyCode → String?
no setter
userKnowledgePanelOrder → List<String>
no setter
userPictureSource → UserPictureSource
no setter
userTracking → bool
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
arePreferencesSetForProject(PreferencesPageProjects project) → bool
Are the preferences set for this project?
countProductLookedUp(String barcode) → Future<void>
No-op for the barcode the page before it already counted. Both values are written before the first await, so a caller that reads them right after, without awaiting, already sees the new count and barcode.
dispose() → void
Discards any resources used by the object.
inherited
donationAsksMuted(DateTime now) → bool
donationStripHidden(DateTime now) → bool
getDevModeString(String tag) → String?
getDonationTestBucket() → int
This install's draw in 0..99, made once and kept.
getExcludedAttributeIds() → List<String>
getFlag(String key) → bool?
getImportance(String attributeId) → String
getImportanceForProject(String attributeId, PreferencesPageProjects project) → String
Gets the importance for an attribute for a specific project.
getLazyCount(String suffixTag) → int?
getUniqueRandom() → Future<int>
Returns a huge random value that will be computed just once.
getUnwantedIngredients() → List<String>
Returns the list of user-facing names for unwanted ingredients. Use this for display purposes.
getUnwantedIngredientsForProject(PreferencesPageProjects project) → List<String>
Returns the list of user-facing names for unwanted ingredients for a specific project.
getUnwantedIngredientTags() → List<String>
Returns the list of canonical tags for unwanted ingredients. Use this when making API calls that require canonical tags.
getUnwantedIngredientTagsForProject(PreferencesPageProjects project) → List<String>
Returns the list of canonical tags for unwanted ingredients for a specific project.
hideDonationStrip(Duration duration) → Future<void>
hideFolksonomyExplanationCard() → Future<void>
hideInputProductNameBanner() → Future<void>
hidePricesExplanationCard() → Future<void>
increaseLanguageUsage(OpenFoodFactsLanguage language) → void
incrementScanCount() → Future<void>
init(ProductPreferences productPreferences) → Future<void>
markDonationReminderShown() → Future<void>
markInAppReviewAsShown() → Future<void>
markPricesFeedbackFormAsCompleted() → Future<void>
muteDonationAsks(Duration duration) → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replaceListener(VoidCallback listener) → void

Available on ChangeNotifier, provided by the ChangeNotifierExtensions extension

resetOnboarding() → Future<void>
setActiveAttributeGroup(String value) → Future<void>
setAppLanguageCode(String? languageCode) → Future<void>
Please use ProductQuery.setLanguage as interface
setColorScheme(String color) → Future<void>
setContrastScheme(String contrastLevel) → Future<void>
setCrashReports(bool state) → Future<void>
setDevMode(int value) → Future<void>
setDevModeString(String tag, String value) → Future<void>
setExcludedAttributeIds(List<String> value) → Future<void>
setFlag(String key, bool? value) → Future<void>
setForMeAttributesFilterType(ForMeAttributesFilterType filter) → Future<void>
setHapticFeedbackEnabled(bool enabled) → Future<void>
setImportance(String attributeId, String importanceId) → Future<void>
setImportanceForProject(String attributeId, String importanceId, PreferencesPageProjects project) → Future<void>
Sets the importance for an attribute for a specific project.
setLastVisitedOnboardingPage(OnboardingPage page) → Future<void>
⚠️ This reports the onboarding funnel, so it must stay AFTER consent. It is today: the first call comes from the welcome page's tap handler, which awaits setUserTracking(true) first. A new entry point that navigated before that tap would report before consent.
setLazyCount(int value, String suffixTag, {required bool notify}) → Future<void>
setPlayCameraSound(bool playSound) → Future<void>
setProductPageActions(Iterable<ProductFooterActionBar> value) → Future<void>
setProductPageTabs(List<String> value) → Future<void>
setReadyForPriceTagValidation(bool state) → Future<void>
setTheme(String theme) → Future<void>
setUnwantedIngredients(Map<String, String> ingredientsMap) → Future<void>
Sets the unwanted ingredients map. ingredientsMap is a map where keys are user-facing names and values are canonical tags.
setUnwantedIngredientsForProject(Map<String, String> ingredientsMap, PreferencesPageProjects project) → Future<void>
Sets the unwanted ingredients map for a specific project.
setUseFlashWithCamera(bool useFlash) → Future<void>
setUserCountryCode(String countryCode) → Future<void>
Please use ProductQuery.setCountry as interface
setUserCurrencyCode(String code) → Future<void>
setUserKnowledgePanelOrder(List<String> source) → Future<void>
setUserPictureSource(UserPictureSource source) → Future<void>
setUserTracking(bool state) → Future<void>
showInputProductNameBanner() → bool
taglineFeedMarkNewsAsClicked(String ids) → Future<void>
taglineFeedMarkNewsAsDisplayed(String ids) → Future<void>
toString() → String
A string representation of this object.
inherited
trackFirstOpenAfterConsent() → Future<void>
Tracks the first app open, once the user has given tracking consent.

Operators

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

Static Methods

getUserPreferences() → Future<UserPreferences>
getUserPreferencesSync() → UserPreferences
Once we initialized with main.dart, we don't need the "async".

Constants

TAG_PRICE_PRIVACY_WARNING → const String
Price privacy warning