flutter google map marker for current position

4,934

Edit: Set myLocationEnabled: true, on the GoogleMap widget. It will automatically take care of that.

This works for a custom marker:
You cannot directly get the location from Google Map.
You can use this location package to get the users location (latitude and longitude) and then add the marker accordingly to the map.

Share:
4,934
Y W
Author by

Y W

Updated on December 22, 2022

Comments

  • Y W
    Y W over 1 year

    How could I have goolge map's style marker for current location , it can even show the direction of current position ?

    this is my code, the marker style of my code is just a pin, i want to have google map's marker style even to show the direction of current position .

     _markerSet.add(
        Marker(
          markerId: MarkerId('current_Postion'),
          infoWindow: InfoWindow(title: 'Current Position'),
          position: _userCurrentPositionLatLng,
          icon: BitmapDescriptor.defaultMarkerWithHue(
            BitmapDescriptor.hueGreen,
          ),
        ),
    

    This is how my marker looks like enter image description here

    This is the google marker which i want to have enter image description here

    Any hints for suggestions?

  • Y W
    Y W almost 4 years
    what i want is a marker icon, like same style of google map's example, please see attached screenshot.
  • Akora Ing. DKB
    Akora Ing. DKB almost 4 years
    Sorry I missed that. I've edited the answer. Please try it and see if it does the job you want.