flutter google map move camera code example

Example: flutter google map change camera position

CameraPosition _initialPosition = CameraPosition(target: _latlng, zoom: 16);
 Position currentLocation;



_getLocation() async {
   currentLocation = await Geolocator()
       .getCurrentPosition(desiredAccuracy: LocationAccuracy.best);

   var newPosition = CameraPosition(
       target: LatLng(currentLocation.latitude, currentLocation.longitude),
       zoom: 16);

   CameraUpdate update =CameraUpdate.newCameraPosition(newPosition);
   CameraUpdate zoom = CameraUpdate.zoomTo(16);

   _mapController.moveCamera(update);      
 }

Tags:

Misc Example