baaba_location 0.1.0 copy "baaba_location: ^0.1.0" to clipboard
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 geolocator and geocoding. Android has no native code of its own; iOS has one native method that reads the location keys in Info.plist. Apps declare the location permissions in their own manifest. The package adds no permissions: geolocator_android is pinned to >=5.1.1+1, which no longer merges FOREGROUND_SERVICE_LOCATION into 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 one LocationResult with the steps it 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.json for every implementation.

  • Geocoding: addressFrom / positionsFrom on the platform geocoder (through the geocoding plugin), 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 with network, cancellation, locales, and pluggable GeocodingProviders 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 a baaba_app_config debug panel.

  • LocationBuilder widget and FakeBaabaLocation in package: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-finite retryAfterMs or a reverseCachePrecisionMeters of zero no longer fails the call; a platform geocoder whose presence check throws now counts as missing, so fallback providers are asked.
  • get() with maxAge: 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 context whose screen has gone (it used to fall back to the root navigator).
  • watch() streams end when the instance is disposed.
  • positionStream listeners get their own interval on 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 changing handlePermission / handleServices runs the flow again.
  • InMemoryLocationPlatform now models the device store (newest fix, age from the fix's timestamp, store filters) and maxAge returning the OS's cached fix.
0
likes
150
points
143
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

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.

Topics

#location #geolocation #geocoding #gps

License

MIT (license)

Dependencies

baaba_permission_handler, device_info_plus, flutter, geocoding, geolocator, geolocator_android, path_provider

More

Packages that depend on baaba_location

Packages that implement baaba_location