moveCameraTo method

void moveCameraTo(
  1. int index
)

The moveCameraTo function moves the camera to the location of the city. @param index The index of the city in the filteredCities list. {@category Functions}

Implementation

void moveCameraTo(int index) {
  mapController.animateCamera(
    CameraUpdate.newCameraPosition(
      CameraPosition(
        target: LatLng(
          double.parse(filteredCities[index].lat.toString()),
          double.parse(filteredCities[index].lng.toString()),
        ),
        zoom: 12,
      ),
    ),
  );
  setState(() {
    filteredCities = [];
  });
}