How do I get map rotation on google maps flutter?

Issue

I’m trying to get the map rotation (bearing) but can’t find it with the map controller.

Using currently google_maps_flutter: ^1.1.1 and flutter: 1.22

Solution

Actually I found what I was looking for. There is the onCameMove callback on GoogleMap constructor and it receives current CameraPosition as its argument. It has the bearing, target, tilt and zoom fields.

This way I can be aware of changes to the map’s bearing at anytime.

PS: This function is executed repeatedly while the user is moving the map and should not perform expensive operations.

Answered By – Rafael Moreira Queiroz

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *