Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Google Maps - Rotate marker according to the driving direction

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

like image 541
Buddhika Avatar asked Jul 10 '19 06:07

Buddhika


People also ask

How do I rotate a marker on Google Maps Flutter?

Now comes the interesting part, we'll add the car to the map as a marker and to make it rotate we'll use the mobile device's compass, we'll ask the direction it's pointing to and this will be passed to the marker every time it changes which will make it rotate in the given direction.

How do I rotate a marker on Google Maps?

Marker({ position: a, map: map, icon: { path: google. maps. SymbolPath. FORWARD_CLOSED_ARROW, scale: 6, fillColor: "red", fillOpacity: 0.8, strokeWeight: 2, rotation: angleDegrees //this is how to rotate the pointer } });


1 Answers

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

Marker( rotation: currentLocation.heading )

like image 75
ThusharaJ Avatar answered Sep 21 '22 10:09

ThusharaJ