flutter_map plugin to request and display the users location and heading on the map

Overview

The plugin is discontinued. Feel free to fork it or checkout similar plugins.

Flutter Map – Location plugin

Flutter Pub

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.

User experience

Status

  • 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.
  • The marker icon can be changed depending on the location accuracy.
  • 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.
  • The location heading is also shown for devices without an gyroscope. We patched flutter_compass for that.

Installation

Add flutter_map to your pubspec:

dependencies:
  flutter_map_location: any # or the latest version on Pub

Android

Ensure the following permissions are present in <project-root>/android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

See reference example code

iOS

Ensure the following permission is present in <project-root>/ios/Runner/Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>App needs access to location and direction when open.</string>

See reference example code

Usage

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:

Default example

... and one with customized button and marker:

Custom example

(Map attribution: © OpenStreetMap contributors)

Credits

The plugin is inspired by user_location_plugin by igaurab.

Comments
  • toggle location on/off

    toggle location on/off

    Hello, is it possible somehow to have toggle controls for location fab button? if clicked -> show location marker and follow if clicked again -> hide location marker and not follow

    Thanks!

    enhancement 
    opened by MichalNemec 7
  • Default app broken

    Default app broken

    Hie, I am trying to run the plugin using the default page app as coded in your example. However am failing to reproduce it and show live tracking of location. Has the coded being change such that the example has been left broken>

    invalid 
    opened by asimbo 5
  • How can i unsubscribed location?

    How can i unsubscribed location?

    I want build a button first click subscribe location and after that is unsubscribed? I can't find an example for this case. Please let me know i can do this?

    help wanted 
    opened by mtan11 5
  • Compass exception

    Compass exception

    Hi,

    I get a compass exception, but anyway it locate me:

    E/flutter ( 3723): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The method 'cast' was called on null.
    E/flutter ( 3723): Receiver: null
    E/flutter ( 3723): Tried calling: cast<double>()
    E/flutter ( 3723): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
    E/flutter ( 3723): #1      FlutterCompass.events.<anonymous closure> (package:flutter_compass/flutter_compass.dart:49:59)
    E/flutter ( 3723): #2      _MapStream._handleData (dart:async/stream_pipe.dart:213:31)
    E/flutter ( 3723): #3      _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
    E/flutter ( 3723): #4      _rootRunUnary (dart:async/zone.dart:1362:47)
    E/flutter ( 3723): #5      _CustomZone.runUnary (dart:async/zone.dart:1265:19)
    E/flutter ( 3723): #6      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
    E/flutter ( 3723): #7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
    E/flutter ( 3723): #8      _DelayedData.perform (dart:async/stream_impl.dart:591:14)
    E/flutter ( 3723): #9      _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
    E/flutter ( 3723): #10     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
    E/flutter ( 3723): #11     _rootRun (dart:async/zone.dart:1346:47)
    E/flutter ( 3723): #12     _CustomZone.run (dart:async/zone.dart:1258:19)
    E/flutter ( 3723): #13     _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
    E/flutter ( 3723): #14     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1202:23)
    E/flutter ( 3723): #15     _rootRun (dart:async/zone.dart:1354:13)
    E/flutter ( 3723): #16     _CustomZone.run (dart:async/zone.dart:1258:19)
    E/flutter ( 3723): #17     _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
    E/flutter ( 3723): #18     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1202:23)
    E/flutter ( 3723): #19     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
    E/flutter ( 3723): #20     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
    
    ➜ flutter --version
    Flutter 2.0.3 • channel unknown • unknown source
    Framework • revision 4d7946a68d (4 months ago) • 2021-03-18 17:24:33 -0700
    Engine • revision 3459eb2436
    Tools • Dart 2.12.2
    
    opened by selankon 4
  • Add a controller #69

    Add a controller #69

    • [x] Add a controller to the plugin options
    • [x] Add function to unsubscribe
    • [ ] Add function to subscribe
    • [ ] Find a way to handle the location service status
    opened by Xennis 4
  • Migrated code to null-safety

    Migrated code to null-safety

    Please note: currently, there are immense issues with the map view provided by flutter_map. These issues are fixed in https://github.com/fleaflet/flutter_map/pull/923. You should not merge this PR until flutter_map published 0.13.1.

    opened by TheOneWithTheBraid 4
  • Migrated underlaying location plugin to geolocator plugin

    Migrated underlaying location plugin to geolocator plugin

    Why did we do this?

    I really like the location plugin's Dart interface, but unfortunately, the underlying native code is awful; both of style and documentation. For our use case, we decided to get rid of the location plugin hence and to move to geolocator plugin.

    Another advantage is compatibility: the geolocator plugin does not rely uniquely on the GMS, but works with LocationManager (native AOSP location implementation) too. An HMS (Huawei mobility service) implementation is on its way.

    In my opinion, free dependencies as in open source are in the spirit of Open Street Map. This is why I propose to use the provided modifications to migrate to geolocator.

    opened by TheOneWithTheBraid 4
  • Add options to set the GPS accuracy

    Add options to set the GPS accuracy

    Hey there,

    is it possible to modify the accuracy of the GPS location like so: https://stackoverflow.com/questions/64714745/flutter-how-to-get-my-location-high-accuracy

    I couldn't find the correct way of doing it with this plugin.

    Thanks in advance!

    enhancement 
    opened by SeCo89 3
  • replace latlong with latlong2?

    replace latlong with latlong2?

    hi, thanks for this great library. i had to replace latlong with latlong2 ~~in order to make it work together with flutter_map. they switched lately in their branch 'issues/829-nullsafety... maybe this is something you want to migrate, too?~~

    nope, not that easy... feel free to delete this issue.

    enhancement 
    opened by tomquas 3
  • Moved archived latlong to latlong2

    Moved archived latlong to latlong2

    The flutter_map package recently moved its coordinate implementation from latlong to latlong2 as latlong was marked as discontinued by its maintainers. I did this change for this package too.

    Please note that the changes won't work up to now as the updated flutter_map is not published yet. To test this change, please override flutter_map to be imported from upstream master.

    I already implemented this change even though the upstream is not published yet as I would like to avoid a transition time in which this package won't be usable.

    enhancement 
    opened by TheOneWithTheBraid 2
  • FLUTTER_MAP RELATIONS: New Documentation

    FLUTTER_MAP RELATIONS: New Documentation

    This message has been sent to multiple plugin authors, so it is not personalised

    As part of https://github.com/fleaflet/flutter_map/pull/992 & https://github.com/fleaflet/flutter_map/discussions/927#discussioncomment-1135466, I (a documentation author) am contacting plugin authors to ensure the information about this plugin on the new documentation is correct; or alternatively, if this plugin is not yet on the existing list, to check whether you would like to add your plugin to the new documentation.

    I would also like you to check you conform to these new rules:

    • this plugin is available via a pub.dev installation to make it easier for developers - if your plugin does not currently have a pub.dev page, please add one or let me know otherwise,
    • the plugin documentation includes enough information for installation and basic setup/functionality,
    • the plugin includes a runnable example and/or screenshots,
    • the plugin description contains the words ' - IN BETA' after the author link on the same line if your plugin is in beta,

    Currently I have copied over the existing plugin descriptions, and you can see these here: https://flutter-map.vercel.app/plugins/list. Please note that this documentation is currently unapproved and should not be used unless otherwise directed, as some information may be incorrect or missing, or might change in the future. There is no ETA at the moment, but things seem to be moving along.

    Should you wish for the description to remain the same as current on the page linked above, you do not have to reply, you can close this issue.

    If you wish to change any information, please leave this issue open and add your reply as a comment.

    flutter_map maintainers do not take any responsibility for this message, I am the sole author.

    On behalf of myself and the flutter_map community thank you for your excellent plugin :).

    opened by JaffaKetchup 1
  • Use sensors_plus instead of flutter_compass

    Use sensors_plus instead of flutter_compass

    The sensors_plus package is of much better code quality, has more maintainers and - in opposite to flutter_compas - compatible with Flutter's 2nd version of Android embedding.

    I would recommend to use sensors_plus instead of flutter_compass.

    opened by TheOneWithTheBraid 6
Flutter_map plugin to display geojson, vector tiles, clusters using sliced vectors

geojson_vector_slicer A flutter_map plugin to display fast geojson by slicing into tiles. Slicing based off https://github.com/mapbox/geojson-vt IMPOR

Ian 4 Oct 18, 2022
Flutter plugin to display a simple flat world map with animated points in real time

Flutter Simple Map Flutter plugin to display a simple flat world map with animated points in real time. Can be used as a presentation of online users,

Vladyslav Korniienko 7 Dec 8, 2022
Provides beautiful animated marker clustering functionality for flutter_map. Inspired by Leaflet.markercluster

Flutter Map Marker Cluster A Dart implementation of Leaflet.markercluster for Flutter apps. This is a plugin for flutter_map package Usage Add flutter

Lorenzo Pongetti 177 Jan 2, 2023
A map tour guide mobile app based on Flutter, an AI travel notes product integrating map tour guide and UGC.

A map tour guide mobile app based on Flutter, an AI travel notes product integrating map tour guide and UGC. Through the combination of 5g + AI, colle

null 24 Jan 14, 2022
Stateful map controller for Flutter Map

Map controller Stateful map controller for Flutter Map. Manage markers, lines and polygons. View the web demo Usage import 'dart:async'; import 'packa

null 55 Sep 15, 2022
Custom map markers - Custom Map Markers Using Flutter

Custom Map Markers Not only "Everything is a widget" also "Everywhere is a widge

null 8 Oct 19, 2022
Flutter Tutorial - Google Map with Live Location Tracking

Flutter Tutorial - Google Map with Live Location Tracking Build Google Map app with Live Location Tracking in Flutter. ✌   App Preview Android Preview

Samuel Adekunle 10 Dec 22, 2022
🌍 Map location picker component for flutter Based on google_maps_flutter

google_map_location_picker Location picker using the official google_maps_flutter. I made This plugin because google deprecated Place Picker. Using Pu

Ibrahim Eid 189 Dec 5, 2022
Flutter package to enable clustering of location markers on Google Maps using widgets specific to each location.

flutter_google_maps_widget_cluster_markers This widget implements a very specific adaptation of google_maps_cluster_manager, allowing different ,marke

Kek Tech 2 Jan 6, 2023
A new flutter plugin for mapbox. You can use it for your map backgrounds inside flutter applications

A new flutter plugin for mapbox. You can use it for your map backgrounds inside flutter applications

Boris Gautier 5 Sep 14, 2022
A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.

Flutter Location Plugin This plugin for Flutter handles getting a location on Android and iOS. It also provides callbacks when the location is changed

Guillaume Bernos 953 Dec 22, 2022
A Flutter package for place search using MapBox Api and for Static map image

About This package provides easy api calls to MapBox Search API. Also, it contains an static map image generator ?? . Maki Icons can be used now in ma

Ketan Choyal 63 Dec 2, 2022
A Flutter package for iOS and Android for picking location and images.

location and image picker package for Flutter A Flutter package for iOS and Android for picking location and images. Demo Installation First, add loca

sk shamimul islam 9 Sep 28, 2022
A flutter package for select a city from svg map.

City Picker From Map A flutter package for select a city from svg map. Supported countries (+150) are here. Screenshots Getting Started In the pubspec

Ahmet ÇELİK 49 Nov 17, 2022
Map Picker for Flutter

Map Pin Picker A Vendor-free map Library for Easy and Quick Usage. Follow the steps to integrate Google Maps (https://pub.dev/packages/google_maps_flu

Akbar 16 Jul 15, 2022
Flutter Google Map Example - Day 41

Flutter Google Map Example - Day 41 class Afgprogrammer extends Flutter100DaysOfCode { video() { return { "title": "Flutter Google Map Exa

Mohammad Rahmani 74 Jan 3, 2023
A Flutter map widget inspired by Leaflet

flutter_map A Dart implementation of Leaflet for Flutter apps. Installation Add flutter_map to your pubspec: dependencies: flutter_map: any # or the

null 2.2k Dec 28, 2022
A map widget with live position updates for Flutter

Livemap A map widget with live position updates. Based on Flutter map and Geolocator. Provides a controller api to handle map state changes. Example i

null 45 Sep 28, 2022
Flutter Google Map Example

Flutter Google Map Example A Flutter application demonstrate google map. Preview Listener and Marker Compass MapTypes Plugin google_maps_flutter from

Bhavik Makwana 67 Sep 14, 2021