testing library

Test doubles for consumers of this package.

Import this in your own tests to drive the whole location flow without a device or a platform channel:

import 'package:baaba_location/testing.dart';

Nothing here is imported by the package's production code, so it adds no weight to your app.

Classes

Address
A postal address from a geocoder.
AddressResult
The outcome of a reverse geocode.
AgedPosition
A last known location with its age, as the platform reports it.
BaabaLocation
Foreground location that never throws.
BackgroundLocation
Opt-in: keep a position stream running while the app is in the background.
ConfigurationCheck
Manifest / Info.plist entries the app lacks.
DiagnosticIssue
One finding of diagnose(), with the exact fix where there is one.
FakeBaabaLocation
A BaabaLocation for tests, with no platform channels.
FakeLocationCall
One call made on a FakeBaabaLocation.
GeocodedPlace
One match of a forward geocode.
GeocodingConfig
How addresses are looked up and cached.
GeocodingProvider
A source of addresses — plug in Google Geocoding, Mapbox, Nominatim or your own backend.
InMemoryGeocodingProvider
The platform geocoder of an InMemoryLocationPlatform: answers from its stubAddress / stubPlaces, and fails as geocodingFailure and geocoderAvailable say.
InMemoryLocationPlatform
A LocationPlatform that lives in memory. It models the native side's behaviour — one merged stream request, native filtering, throttled last-known writes, pausing in the background — so tests run the real flow without a device.
LatLng
A point on the earth in degrees (WGS 84).
LocationAccess
The app's location access: whether it is allowed, and how precisely.
LocationBuilder
Runs get() and builds from its final result — the common "show where I am" UI in one widget.
LocationConfig
App-wide settings for BaabaLocation. Every field has a default, so init is optional.
LocationDiagnostics
The setup doctor's report.
LocationFailure
A typed, actionable failure. Never thrown, always returned.
LocationObserver
One place to watch every location event — for analytics, crash reporting, or a debug overlay.
LocationPlatform
The only thing that touches the OS. GeolocatorLocationPlatform in production, InMemoryLocationPlatform in tests.
LocationProfile
A named set of location settings, so most apps never touch individual knobs. Copy one to adjust it:
LocationResult
The final outcome of a location call. Never thrown, always returned.
LocationStatus
A change on the status stream: services switched, permission changed, precision changed, or streams paused for the background.
PlatformFix
The answer to a single-fix request.
PlatformLastKnown
The OS's and the package's last known locations.
Position
One location fix.
PositionEvent
One event on the native position stream.
PositionFilters
Quality filters applied to every fix before the app sees it.
PositionsResult
The outcome of a forward geocode: every match, best first.
StreamRequest
What the native position stream should deliver. One per platform subscription: several Dart listeners are merged into the most demanding request with StreamRequest.merge.

Enums

DiagnosticSeverity
FakeUserResponse
How the simulated user answers a prompt shown inside get().
FilterReason
Why a fix was dropped. Reported to LocationObserver.onFiltered.
LocationAccuracy
How hard the device works for a fix. The app chooses; the package never raises it on its own.
LocationFailureReason
Why a location call could not give the app what it asked for.
LocationPermissionState
Whether the app may use location, as the OS sees it now.
LocationResolution
What the app can do about a LocationFailure. Pass the failure to BaabaLocation.instance.resolve(failure) to do it.
LocationSource
Where a result's position came from.
LocationStep
What a get() flow did, in order. For analytics and debugging.
PositionProvider
Which source produced a fix, where the platform says.
PrecisionNeed
Whether a profile needs precise location.
ServicesResolution
The outcome of Android's in-app "turn on location" dialog.

Typedefs

LocationFailureBuilder = Widget Function(BuildContext context, LocationFailure failure, VoidCallback retry)
Builds the failure state. Call retry to run the flow again.
LocationPermissionStep = Future<void> Function(BuildContext? context, LocationAccess current)
Replaces the package's permission step in get(), watch() and ensurePermission(): show your own UI, ask however you like. The package re-checks the permission afterwards, so the return value is not needed.