bounds property

Future<List<double?>?> get bounds

An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: [sw.lng, sw.lat, ne.lng, ne.lat]. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL.

Implementation

Future<List<double?>?> get bounds async {
  return _style?.getStyleSourceProperty(id, "bounds").then((value) {
    if (value.value != '<null>') {
      if (Platform.isIOS) {
        return (json.decode(value.value) as List)
            .cast<int>()
            .map((e) => e.toDouble())
            .toList();
      } else {
        return (json.decode(value.value) as List).cast<double>();
      }
    } else {
      return null;
    }
  });
}