LocationService class abstract
Service interface for location operations.
Example:
// Start location tracking
await Locus.location.start();
// Get current position
final position = await Locus.location.getCurrentPosition();
// Listen to location updates
Locus.location.stream.listen((location) {
print('New location: ${location.coords}');
});
// Query historical locations
final history = await Locus.location.query(LocationQuery(
from: DateTime.now().subtract(Duration(hours: 1)),
));
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
heartbeats
→ Stream<
Location> -
Stream of heartbeat locations (periodic updates when stationary).
no setter
-
motionChanges
→ Stream<
Location> -
Stream of motion changes (moving/stationary transitions).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
Location> -
Stream of location updates.
no setter
Methods
-
changePace(
bool isMoving) → Future< bool> - Changes the motion state (moving/stationary).
-
destroyLocations(
) → Future< bool> - Destroys all stored locations.
-
getCurrentPosition(
{int? samples, int? timeout, int? maximumAge, bool? persist, int? desiredAccuracy, JsonMap? extras}) → Future< Location> - Gets the current position.
-
getLocations(
{int? limit}) → Future< List< Location> > - Gets stored locations.
-
getSummary(
{DateTime? date, LocationQuery? query}) → Future< LocationSummary> - Gets a summary of location history.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onHeartbeat(
void callback(Location), {Function? onError}) → StreamSubscription< Location> - Subscribes to heartbeat events.
-
onLocation(
void callback(Location), {Function? onError}) → StreamSubscription< Location> - Subscribes to location updates.
-
onMotionChange(
void callback(Location), {Function? onError}) → StreamSubscription< Location> - Subscribes to motion change events.
-
query(
LocationQuery query) → Future< List< Location> > - Queries stored locations with filtering and pagination.
-
setOdometer(
double value) → Future< double> - Sets the odometer value.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited