LocationManagement class
A Flutter utility for managing device location using the geolocator package. This library provides methods to detect the user's current location and listen for location updates.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
detectMyLocation(
) → Future< MyLocation> - Detects and returns the user's current location as a MyLocation object.
-
getDistance(
{required double startLatitude, required double startLongitude, required double endLatitude, required double endLongitude}) → Future< double> - Calculates the distance in meters between two geographic coordinates.
-
getPositionStream(
dynamic onPositionUpdate(MyLocation)) → Future< StreamSubscription< Position> ?> - Returns a StreamSubscription listening to position updates.
-
getSpeedInKMH(
) → Future< String> - Returns the current speed of the device in kilometers per hour (km/h) as a formatted string.
-
isWithinRadius(
{required double lat1, required double lon1, required double lat2, required double lon2, double radiusInMeters = 50}) → bool -
Returns
true
if the distance between two geographic coordinates is less than or equal toradiusInMeters
. -
openSetting(
) → Future< bool> - Opens the app settings screen so the user can manually change permissions.
-
stopPositionStream(
) → Future< void> - Stops the currently active position stream subscription.