InvalidCoordinateException class

Exception thrown when geographical coordinates are invalid.

Coordinates are considered invalid if:

  • Latitude is outside -90, 90
  • Longitude is outside -180, 180
  • Values are NaN or infinite

Example:

try {
  final point = GeoPoint(latitude: 100, longitude: 0);
} on InvalidCoordinateException catch (e) {
  print('Invalid coordinate: ${e.message}');
}
Inheritance

Constructors

InvalidCoordinateException(String message, {double? latitude, double? longitude, String? code})
const
InvalidCoordinateException.invalid({required double latitude, required double longitude})
Creates an exception for both invalid coordinates.
factory
InvalidCoordinateException.invalidLatitude(double value)
Creates an exception for invalid latitude.
factory
InvalidCoordinateException.invalidLongitude(double value)
Creates an exception for invalid longitude.
factory
InvalidCoordinateException.notFinite({double? latitude, double? longitude})
Creates an exception for NaN or infinite values.
factory

Properties

cause Object?
Optional underlying exception
finalinherited
code String?
Optional error code for programmatic handling
finalinherited
hashCode int
The hash code for this object.
no setterinherited
latitude double?
The invalid latitude value, if applicable
final
longitude double?
The invalid longitude value, if applicable
final
message String
Human-readable error message
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited