getZoomRange method

Future<({double maxZoom, double minZoom})> getZoomRange()

Reads the zoom limits reported by this map's native SDK.

Implementation

Future<({double minZoom, double maxZoom})> getZoomRange() async {
  final data = await _invoke<Map<dynamic, dynamic>?>('getZoomRange');
  final min = data?['minZoom'];
  final max = data?['maxZoom'];
  if (min is! num ||
      max is! num ||
      !min.isFinite ||
      !max.isFinite ||
      min < 3 ||
      max > 20 ||
      min > max) {
    throw PlatformException(code: 'zoom_range_unavailable');
  }
  return (minZoom: min.toDouble(), maxZoom: max.toDouble());
}