Search code examples
google-mapsflutterdarthybrid-mobile-app

Flutter google_maps pinch to zoom


I am trying to implement a google_maps in flutter where I can zoom-in and zoom-out by pinching like official google maps. I cannot find any method for implementing the same. My code snippet is -

GoogleMap(
       onMapCreated: _onMapCreated,
       initialCameraPosition: CameraPosition(
       target: _center,
       zoom: -3.0
       ),
       scrollGesturesEnabled: true,
       zoomGesturesEnabled: true,
       myLocationButtonEnabled: false,
       gestureRecognizers: Set()
         ..add( Factory<PanGestureRecognizer>(() => PanGestureRecognizer())),
       markers: markers
   );

Thanks in advance.


Solution

  • The problem is that the zoom level is negative however the min zoom level is 0.