Location class

The main access point to the location plugin.

Implemented types
  • PlatformInterface

Constructors

Location()
Initializes the plugin and starts listening for potential platform events.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
onLocationChanged Stream<LocationData>
Returns a stream of LocationData objects. The frequency and accuracy of this stream can be changed with changeSettings
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

changeNotificationOptions({String? channelName, String? title, String? iconName, String? subtitle, String? description, Color? color, bool? onTapBringToFront}) Future<AndroidNotificationData?>
Change options of sticky background notification on Android.
override
changeSettings({LocationAccuracy? accuracy = LocationAccuracy.high, int? interval = 1000, double? distanceFilter = 0}) Future<bool>
Changes settings of the location request.
override
enableBackgroundMode({bool? enable = true}) Future<bool>
Enables or disables service in the background mode.
override
getLocation() Future<LocationData>
Gets the current location of the user.
override
hasPermission() Future<PermissionStatus>
Checks if the app has permission to access location.
override
isBackgroundModeEnabled() Future<bool>
Checks if service is enabled in the background mode.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestPermission() Future<PermissionStatus>
Requests permission to access location.
override
requestService() Future<bool>
Request the activation of the location service.
override
serviceEnabled() Future<bool>
Checks if the location service is enabled.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance Location
Singleton instance of this class. Use it instead of the factory constructor to make it explicit that you're using a singleton, not creating a new Location instance each time.
getter/setter pair