Flutter Map – Location plugin
A flutter_map plugin to request and display the users location and heading on the map. The core features of the plugin are:
- Customization: The location button and marker can be completly customized.
- Energy efficiency: The location service is turned off if the app runs in the background.
- Usability: Developers are empowered to ensure a good user experience.
- [x] The location button can be changed dependening on the location services status. For example also Google Maps shows a different icon if the location service is off.
- [x] The marker icon can be changed depending on the location accuracy.
- [x] It’s possible to show the information (e.g. in form of a snackbar) to the user that the user location is outside of the map bounds.
- [x] The location heading is also shown for devices without an gyroscope. We patched flutter_compass for that.
Add flutter_map to your pubspec:
dependencies: flutter_map_location: any # or the latest version on Pub
Ensure the following permissions are present in
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Ensure the following permission is present in
<key>NSLocationWhenInUseUsageDescription</key> <string>App needs access to location and direction when open.</string>
Look at the default example and the notes inside the code. That’s a working example.
Demo / example
A working example can be found in the
example/ directory. It contains a page with the default settings:
… and one with customized button and marker: