getViewportBounds method

  1. @override
Future<LatLngBounds> getViewportBounds()
override

Implementation

@override
Future<LatLngBounds> getViewportBounds() async {
  final bounds = await (await mapController.future).getBounds();
  final parsedBounds = LatLngBounds.fromPoints(
    [
      LatLng(
        bounds.bounds.northeast.latLng.latitude.toDouble(),
        bounds.bounds.northeast.latLng.longitude.toDouble(),
      ),
      LatLng(
        bounds.bounds.southwest.latLng.latitude.toDouble(),
        bounds.bounds.southwest.latLng.longitude.toDouble(),
      ),
    ],
  );
  return parsedBounds;
}