LocalePrefProvider class final

User-selected UI language. null means "follow the device locale" — the root MaterialApp.locale is left null and Flutter resolves against AppLocalizations.supportedLocales. Persisted to SharedPreferences.

As a side effect this keeps Intl.defaultLocale in sync with the effective language so the app's bare DateFormat call-sites format dates for the chosen locale instead of always en_US (audit M6). When the pref is null (follow-system), Intl.defaultLocale is cleared so intl falls back to the platform locale.

Inheritance

Properties

argument → Object?
If this provider was created with the .family modifier, argument is the variable that was used.
finalinherited
dependencies → Iterable<ProviderOrFamily>?
The list of providers that this provider potentially depends on.
finalinherited
from → Family?
If this provider was created with the .family modifier, from is the .family instance.
finalinherited
future → Refreshable<Future<Locale?>>
Obtains the Future representing this provider.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isAutoDispose → bool
Whether the state associated to this provider should be disposed automatically when the provider stops being listened.
finalinherited
name → String?
A custom label for providers.
finalinherited
notifier → Refreshable<LocalePref>
no setterinherited
origin → ProviderBase<AsyncValue<Locale?>>
The provider that is overridden.
no setterinherited
retry → Retry?
The retry strategy to use when a provider fails.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

create() → LocalePref
@nodoc
debugGetCreateSourceHash() → String
A debug-only function for obtaining a hash of the source code of the initialization function.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overrideWith(LocalePref create()) → Override
Override the provider with a new initialization function.
inherited
overrideWithBuild(RunNotifierBuild<LocalePref, FutureOr<Locale?>> build) → Override
Overrides the build method of a notifier, allowing you to replace the default implementation with a custom one for testing or specific use cases.
inherited
selectAsync<OutT>(OutT selector(Locale? data)) → ProviderListenable<Future<OutT>>
A variant of select for asynchronous values
inherited

Operators

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