13

Can anyone share a documentation / code sample for Flutter google maps plugin where I can rotate the marker ( ex: a car icon ) according to the driving direction. I saw this can be achieved on native library by rotating the marker. But couldn't fjnd any option to rotate the marker in Flutter.

I guess we need to consider below points while rotating the marker. Please add your thoughts on this as well.

Map North Direction. Devices rotation from compass.

Thanks

Buddhika
  • 577
  • 2
  • 6
  • 20

2 Answers2

15

https://pub.dev/packages/location plugin :

Marker( rotation: currentLocation.heading )

ThusharaJ
  • 409
  • 4
  • 7
1

you can add compass plugin https://pub.dev/packages/flutter_compass and simply set the result direction to marker

  • flutter_compass is working for this solution. but this plugin not support for all devices. example: Huawei, Xiaomi – BIS Tech Feb 26 '20 at 06:28
  • 1
    @BloodLoss there is another solution, please use location plugin https://pub.dev/packages/location plugin, which will give you the heading direction – Srinivas Rao Palchuri Feb 27 '20 at 08:20