InvalidPolygonException class

Exception thrown when a polygon is invalid.

A polygon is considered invalid if:

  • It has fewer than 3 vertices
  • It has duplicate consecutive vertices
  • It has self-intersecting edges
  • Vertices contain invalid coordinates

Example:

try {
  GeoPolygonService.validatePolygon(polygon);
} on InvalidPolygonException catch (e) {
  print('Invalid polygon: ${e.message}');
}
Inheritance

Constructors

InvalidPolygonException(String message, {int? vertexCount, String? code})
const
InvalidPolygonException.duplicateVertices()
Creates an exception for duplicate consecutive vertices.
factory
InvalidPolygonException.invalidStructure([String? detail])
Creates an exception for invalid polygon structure.
factory
InvalidPolygonException.selfIntersecting()
Creates an exception for self-intersecting polygon.
factory
InvalidPolygonException.tooFewVertices(int count)
Creates an exception for insufficient vertices.
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
message String
Human-readable error message
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vertexCount int?
The number of vertices in the invalid polygon
final

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