FlutterLocationPlus class
Main entry point for the flutter_location_plus plugin.
Create a single instance and reuse it throughout your app:
final location = FlutterLocationPlus();
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
-
getBestLocation(
) → Future< String?> - Returns the most accurate last-known fix across all enabled providers. Picks the fix with the smallest accuracy radius (GPS > Network > Passive).
-
getGpsLocation(
) → Future< String?> -
Returns the last-known fix from the GPS (satellite) provider.
Most accurate outdoors; may return
nullindoors or before first fix. -
getNetworkLocation(
) → Future< String?> - Returns the last-known fix from the Network (cell/Wi-Fi) provider. Fast and works indoors; less accurate than GPS.
-
getPassiveLocation(
) → Future< String?> - Returns the last-known fix from the Passive provider. Zero battery cost — reuses fixes requested by other apps.
-
liveLocation(
{String provider = 'best', int intervalMs = 2000, double distanceMeters = 0}) → Stream< LocationData> - Starts continuous location updates and returns a broadcast Stream of LocationData objects. The stream stays open until stopLiveLocation is called or the widget is disposed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
stopLiveLocation(
) → Future< void> - Stops the active live-location session and removes the native listener. Always call this in State.dispose to avoid battery drain.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited