MethodChannelLocation class

The interface that implementations of location must extend.

Platform implementations should extend this class rather than implement it as location does not consider newly added methods to be breaking changes. Extending this class (using extends) ensures that the subclass will get the default implementation, while platform implementations that implements this interface will be broken by newly added LocationPlatform methods.

Inheritance

Constructors

MethodChannelLocation()
Initializes the plugin and starts listening for potential platform events.
factory
MethodChannelLocation.private(MethodChannel? _methodChannel, EventChannel? _eventChannel)
This constructor is only used for testing and shouldn't be accessed by users of the plugin. It may break or change at any time.

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>
Change settings of the location request.
override
enableBackgroundMode({bool? enable}) 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