How do you disable the rotation of the map in flutter_map?


Solution 1: Dan Gerchcovich

Looking at the API Documentation, there is a class MultiFingerGesture. This looks like it controls the gestures on the Widget, and there is an option to only allow PinchMove, or PinchZoom. The default looks like it's the all option. If you change the Map's property that equates to this class, and change to either PinchMove, or PinchZoom then it should work. Please review the class here:

https://pub.dev/documentation/flutter_map/latest/flutter_map.plugin_api/MultiFingerGesture-class.html


Solution 2: João Martins

As written by @pskink the answer is to use the InteractiveFlag provided by flutter_map in such a way

MapOptions(
    minZoom: 11.0,
    maxZoom: 17.0,
    center: LatLng(lat, lng),
    interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
    zoom: 13.0,
  ),

By doing this, you can ensure that only pinchZoom and drag actions are allowed in your map.


Solution 3: Safrankuchen

This is better:

MapOptions (  
    interactiveFlags: InteractiveFlag.all & ~InteractiveFlag.rotate,
 )