LocaleUnitsProvider

The display units, as values that change over time.

Consumers depend on this rather than on LocaleChangeNotifier directly. The notifier only says that something changed, which left every consumer to write the same "prime, then re-read" derivation by hand — and a consumer that forgot the priming step, or was never given the notifier at all, silently kept stale units. Owning the read in one place also makes the value injectable, so a test can flip metric to imperial instead of asserting on plumbing.

The user's in-app units choice (UnitsOverride) is folded in here, so every consumer honors it by construction — a call site that read the OS directly would follow the locale but ignore the setting, splitting the app the way mixed unit sources always have.

Both values are StateFlows: they emit the current value on collection, again on every change, and expose a synchronous .value for the few call sites that format outside a collector.

Inheritors

Properties

Link copied to clipboard
abstract val measurementSystem: StateFlow<MeasurementSystem>
Link copied to clipboard
abstract val temperatureUnit: StateFlow<TemperatureUnit>