changePositionTo method

void changePositionTo(
  1. BuildContext context,
  2. GoogleMapsControllerVariableEntity controller,
  3. ConditionParameter latitude,
  4. ConditionParameter longitude,
  5. int loop,
)

Implementation

void changePositionTo(
  BuildContext context,
  GoogleMapsControllerVariableEntity controller,
  ConditionParameter latitude,
  ConditionParameter longitude,
  int loop,
) async {
  if (controller.mapController == null) return;
  final lat = double.tryParse(latitude.getValue(context, loop));
  final lng = double.tryParse(longitude.getValue(context, loop));
  if (lat == null || lng == null) return;
  controller.mapController!.animateCamera(CameraUpdate.newCameraPosition(
    CameraPosition(
      target: LatLng(lat, lng),
      zoom: controller.cameraPosition?.zoom ?? 0.0,
      tilt: controller.cameraPosition?.tilt ?? 0.0,
      bearing: controller.cameraPosition?.bearing ?? 0.0,
    ),
  ));
}