setZoomLevel method

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

Set a new zoom level centered on the specified screen position.

This may be between 0 and maxZoomLevel

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

On success, the previous zoom level. On error, the error code.

Throws

  • An exception if it fails.

Implementation

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

  return resultString['result'];
}