getCurrentPosition method
Returns the current position.
You can control the settings used for retrieving the location by supplying
locationSettings
.
Calling the getCurrentPosition method will request the platform to obtain a location fix. Depending on the availability of different location services, this can take several seconds. The recommended use would be to call the getLastKnownPosition method to receive a cached position and update it with the result of the getCurrentPosition method.
Note: On Android, when setting the location accuracy, the location accuracy is interpreted as location priority. The interpretation works as follows:
LocationAccuracy.lowest -> PRIORITY_PASSIVE: Ensures that no extra power will be used to derive locations. This enforces that the request will act as a passive listener that will only receive "free" locations calculated on behalf of other clients, and no locations will be calculated on behalf of only this request.
LocationAccuracy.low -> PRIORITY_LOW_POWER: Requests a tradeoff that favors low power usage at the possible expense of location accuracy.
LocationAccuracy.medium -> PRIORITY_BALANCED_POWER_ACCURACY: Requests a tradeoff that is balanced between location accuracy and power usage.
LocationAccuracy.high+ -> PRIORITY_HIGH_ACCURACY: Requests a tradeoff that favors highly accurate locations at the possible expense of additional power usage.
Implementation
Future<Position> getCurrentPosition({
LocationSettings? locationSettings,
}) {
throw UnimplementedError('getCurrentPosition() has not been implemented.');
}