centerPoint property

  1. @override
Coordinates get centerPoint
override

Retrieves the center point of the geographic area. Calculates and returns the geographic center of the area.

Returns

  • Coordinates object representing the center point of the area.

Implementation

@override
Coordinates get centerPoint {
  final bool isAltitudeNull =
      topLeft.altitude == null || bottomRight.altitude == null;

  return Coordinates(
    latitude: (topLeft.latitude + bottomRight.latitude) * 0.5,
    longitude: (topLeft.longitude + bottomRight.longitude) * 0.5,
    altitude: isAltitudeNull
        ? null
        : (topLeft.altitude! + bottomRight.altitude!) * 0.5,
  );
}