baaba_location 0.1.0
baaba_location: ^0.1.0 copied to clipboard
Foreground location for Flutter that never throws: one call runs permission, services, fix, fallback and address lookup, with filters, a setup doctor and a test double.
0.1.0-dev #
Not released.
-
Built on
geolocatorandgeocoding. Android has no native code of its own; iOS has one native method that reads the location keys inInfo.plist. Apps declare the location permissions in their own manifest. The package adds no permissions:geolocator_androidis pinned to>=5.1.1+1, which no longer mergesFOREGROUND_SERVICE_LOCATIONinto every app. -
BaabaLocation: foreground location behind one API that never throws.get()runs permission, location services, precision, fix, fallback to the last known location and address lookup, and returns oneLocationResultwith thestepsit took. Concurrent calls share one flow and one set of dialogs. -
Low-level calls with no UI:
currentPosition,lastKnownPosition(the newer of the OS's and the package's own stored copy, kept in the app's cache directory, which neither OS backs up),positionStream(one shared subscription, per-listener filters, pauses in the background and when services or permission go, resumes by itself),statusStream,checkPermission,requestPrecise. -
Filters: accuracy, impossible jumps, mocked fixes, null island, duplicates and out-of-order fixes, specified once in
test/fixtures/filter_vectors.jsonfor every implementation. -
Geocoding:
addressFrom/positionsFromon the platform geocoder (through thegeocodingplugin), with a per-provider queue, back-off on throttling, a grid-keyed cache, an offline check, a fallback to the nearest cached address when every provider fails withnetwork, cancellation, locales, and pluggableGeocodingProviders with fallbacks. -
BackgroundLocation(opt-in): keeps a stream running in the background — geolocator's foreground service with your notification on Android, background updates with the indicator on iOS. Only while the process lives; nothing is buffered on disk. -
Profiles:
checkIn,nearby,navigation,delivery,fitness,batterySaver. -
diagnose(): a setup doctor with the exact snippet for every problem;toMap()drops into abaaba_app_configdebug panel. -
LocationBuilderwidget andFakeBaabaLocationinpackage:baaba_location/testing.dart.
Fixed before release:
- The stored last known location: a fix that arrived while the file was first being read was overwritten by the older stored value, a second read during that load saw nothing, and a failed write was never retried.
- Geocoding: an expired cache entry was deleted on lookup, so offline lookups could no longer fall back to it; time spent queued for a provider now counts against
GeocodingConfig.timeout; a request superseded during a back-off is no longer sent; a non-finiteretryAfterMsor areverseCachePrecisionMetersof zero no longer fails the call; a platform geocoder whose presence check throws now counts as missing, so fallback providers are asked. get()withmaxAge: a cached OS fix that fails the filters now leads to a fresh fix instead of straight to the fallback. Concurrent calls are joined by profile equality, not hash code.- No dialog is shown for a
contextwhose screen has gone (it used to fall back to the root navigator). watch()streams end when the instance is disposed.positionStreamlisteners get their ownintervalon iOS too, which has no native interval.- Android: a stream started while the "turn on location" dialog was up no longer inherits the dialog's request (and loses its background notification); the dialog's GPS request ends with
flowTimeout. LocationBuilder: retry no longer runs the permission or services dialog twice when the user says no, and changinghandlePermission/handleServicesruns the flow again.InMemoryLocationPlatformnow models the device store (newest fix, age from the fix's timestamp, store filters) andmaxAgereturning the OS's cached fix.