GeoPoint constructor

GeoPoint({
  1. required double latitude,
  2. required double longitude,
})

Implementation

GeoPoint({
  required this.latitude,
  required this.longitude,
}) {
  if (latitude.isNaN) {
    throw ArgumentError.value(
      latitude,
      'latitude',
      'Value for argument "latitude" is not a valid number',
    );
  }
  if (longitude.isNaN) {
    throw ArgumentError.value(
      longitude,
      'longitude',
      'Value for argument "longitude" is not a valid number',
    );
  }

  if (latitude < -90 || latitude > 90) {
    throw ArgumentError.value(
      latitude,
      'latitude',
      'Latitude must be in the range of [-90, 90]',
    );
  }
  if (longitude < -180 || longitude > 180) {
    throw ArgumentError.value(
      longitude,
      'longitude',
      'Longitude must be in the range of [-180, 180]',
    );
  }
}