📍Geolocation Overview
Geolocation includes the following features:
Track a user's location
Get the current location
Customize the accuracy of the tracking
Android and iOS support, using built-in services.
Built-in Location permission handling
Built-in services are used for Android and iOS. That means that there is restrictions to its usage.
Quickstart
Include the required dependencies for your targets, see All Dependencies.
Create the Geolocator
Creating a geolocator depends on your platform, but in the simplest use-case of an Android & iOS only targets. You can do something like this:
Get current location
Getting the current location is simple, just call:
Or if you only care about the result:
Compass will handle asking the user for while-in-use location permissions. If they deny the permission then the result will be PermissionError.
If the user has denied the permission permanently, you will need to prompt the user to open the settings.
Last updated