setSlippyZoomLevel method

double setSlippyZoomLevel(
  1. double zoomLevel, {
  2. int duration = 0,
  3. Point<int>? screenPosition,
})

Set a new zoom level based on slippy tile level. When 'follow position' is active, the current position will be used as the reference point for the operation. Otherwise, the screen center will be used. The zoom level may be between 0 and MaxSlippyZoomLevel.

Parameters

  • IN zoomLevel Zoom level
  • IN duration The animation duration in milliseconds (0 means no animation).
  • IN screenPosition Screen coordinates on which the map should stay centered. The coordinates are relative to the parent view screen.

Returns

The previous zoom level.

Throws

  • An exception if it fails.

Implementation

double setSlippyZoomLevel(
  final double zoomLevel, {
  final int duration = 0,
  final Point<int>? screenPosition,
}) {
  final OperationResult resultString = objectMethod(
    _pointerId,
    'MapView',
    'setSlippyZoomLevel',
    args: <String, Object>{
      'zoomLevel': zoomLevel,
      'duration': duration,
      if (screenPosition != null) 'xy': XyType<int>.fromPoint(screenPosition),
    },
  );

  return resultString['result'];
}