centerPointAnimated method

void centerPointAnimated(
  1. TickerProvider vsync,
  2. LatLng point, {
  3. Duration duration = const Duration(milliseconds: 250),
  4. double? zoom,
})

Implementation

void centerPointAnimated(TickerProvider vsync, LatLng point,
    {Duration duration = const Duration(milliseconds: 250), double? zoom}) {
  final tween = LatLngTween(begin: camera.center, end: point);
  final ctrl = AnimationController(vsync: vsync, duration: duration);
  final anim = CurvedAnimation(parent: ctrl, curve: Curves.easeOut);

  ctrl.addListener(() => move(tween.evaluate(anim), zoom ?? camera.zoom));
  ctrl.addStatusListener((s) {
    if (s == AnimationStatus.completed) ctrl.dispose();
  });
  ctrl.forward();
}