uzmaps_core library
uzmaps_core — the foundation of every UzMaps Flutter surface.
Design tokens, the motion engine, four-language strings, geo and formatting helpers, async plumbing and the on-device stores. No third-party dependencies: everything a plugin would drag in is one interface away instead.
Classes
- AppSettings
- The app's settings, observable by everything that cares.
- CountUpText
- A number that counts up (or between values) when it changes — route durations and distances feel alive instead of snapping.
- Debouncer
- Trailing-edge debouncer: the last call inside the window wins.
-
Err<
T> - FadeThrough
- Fade-through: out with the old (fade + slight scale down), in with the new (fade + scale up). For swapping panel contents in place.
- FileKVStore
- The web has no file system to write to; the store degrades to memory. Same name as the io implementation so the conditional export above needs no renaming.
- FrameCoalescer
- A listenable that coalesces bursts of changes into one notification per frame — the heartbeat of anything that updates every position report but should repaint once.
- Geo
- Geo helpers shared by everything that touches coordinates.
- KVStore
- A tiny key/value store.
- KVWriteQueue
- Utility shared by file-backed implementations: apply a mutation under a small write queue so rapid setting cannot interleave partial files.
- MemoryKVStore
- The in-memory implementation.
-
Ok<
T> - PressableScale
- Press feedback for anything tappable: scales to 0.97 with a haptic tick, and back with overshoot. The app's universal "this is a button" feel.
- PulseMarker
- Expanding pulse rings for the current-location marker and recording badge.
-
Result<
T> - A value-or-error container, so async flows can return failure as data instead of throwing through widget trees.
- RetryPulse
-
Fires
actionafter delay unless cancelled — the "did the network come back?" auto-retry behind the offline banner. - S
-
Every string the app shows, read through S.t — a context-free static API whose
output follows
AppSettings.language. - SavedPlace
- One saved place. key is identity: the API result id, or rounded coordinates for a pin — the same rule the web app uses, so saved lists survive index rebuilds.
- SavedPlaces
- The saved-places store: one home, one work, favorites beyond count, and a note on each. ChangeNotifies so lists and sheets stay in step.
- Shimmer
- The shimmer behind every skeleton. Draws a moving highlight band over child; a skeleton is a grey shape wrapped in one of these.
- Skeleton
- Skeleton primitives — grey shapes wrapped in Shimmer.
- StaggeredList
- Staggered entrance for list children: each item slides up and fades in a beat after the previous one. Wrap the list; it animates once on first build.
- Trip
- One recorded trip: where it went, how long it took, and — the part the user adds — how it was. On-device only; the server has no trip API, and this is honest about it.
- TripJournal
- The trip journal. Trips are appended by the navigator when one ends; the journal holds them, lets the user rate and annotate each, and computes the profile stats.
- TripRecorder
- The live trip recorder: started with a route, ticks time and distance, and hands a finished Trip to the journal on arrival — or discards itself when navigation is abandoned. A state machine, not a timer widget: navigation owns the ticking.
- UzColors
- The brand palette.
- UzMotion
- Motion is a language, not a pile of durations: entering things decelerate, leaving things accelerate, and cross-fades happen at the standard pace.
- UzRadius
- Corner radii. Small things get small radii; sheets and cards read as one system.
- UzShadows
- The three elevation levels a floating surface can sit at. Over a map, shadows carry the hierarchy — there are no opaque panels behind anything.
- UzSpacing
- Space, in multiples of 4.
Enums
- SavedTag
- How a place was saved.
- TripMode
- Travel modes a trip can be recorded in, matching the API's route modes.
- UzLanguage
- Interface languages the app ships, with their string-table keys.
- UzThemeChoice
- Theme selection.
- UzUnits
- Units distances are shown in.
Extensions
-
IterableFindX
on Iterable<
T> -
Iterable helpers the packages use instead of pulling in
package:collection. - TripModeX on TripMode
- UzLanguageX on UzLanguage
Functions
-
formatDistance(
double m, {bool imperial = false}) → String - Metres, shown the way a maps app shows them, honoring the unit setting: "350 m" → "1.2 km" → "42 km", or the imperial ladder once chosen.
-
formatDuration(
double s) → String - Seconds, as "42 min" or "3 soat 5 daq". Under a minute reads as a minute — "0 min" is a lie about arriving.
-
formatDurationCompact(
double s) → String - A compact duration for cards: "3:42" when over an hour, "42 min" under.
-
formatHm(
int minutes) → String - Minutes after midnight as "HH:MM"; 1440 reads "24:00", as a closing time should.
-
formatTripDate(
DateTime at) → String - A friendly date: "Bugun"/"Today", "Yesterday"-class words, else d MMM.
-
retry<
T> (Future< T> action(), {int attempts = 3, Duration base = const Duration(milliseconds: 350), bool retryIf(Object error)?}) → Future<T> -
Runs
action, retrying transient failures with exponential backoff.
Typedefs
- KVChangeListener = void Function(String key)
- A change sink for stores that want to broadcast (the app's persistence adapter uses it to keep multiple store instances honest). Nothing above this file needs it.