Package selection guidance compiled from public package information, community data, and project usage.
superdeclarative_geometry is a Dart package offering first-class support for angles, polar coordinates, and geometric calculations. Designed for precision and ease of use, it provides intuitive APIs to work with rotational math, vector transformations, and coordinate system conversions. Ideal for applications requiring advanced geometry handling, such as animations, game development, or data visualization. The package is cross-platform, supporting Android, iOS, Web, macOS, Windows, and Linux, making it versatile for Flutter projects across devices.
Use cases
2D/3D graphics rendering
Interactive UI animations
Game development mechanics
Data visualization with radial layouts
Coordinate system conversions
Rotational physics simulations
Key features
Native angle and polar coordinate types
Efficient geometric transformations
Cross-platform compatibility
Clean, readable API design
Support for radians and degrees
Built-in conversion utilities
Suitable for
Flutter developers working with geometry
UI/UX designers needing precise rotations
Game developers requiring vector math
Visualization tool creators
Educational apps involving math concepts
Considerations
Requires understanding of polar and angular math
May add overhead for simple linear layouts
Best suited for projects with geometric complexity
Not optimized for high-frequency real-time calculations
Limited documentation beyond basic examples
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
SuperDeclarative Geometry
First-class support for angles, polar coordinates, and related math.
If you get value from this package, please consider supporting SuperDeclarative!
Get Started
dependencies:superdeclarative_geometry:^[VERSION]
Quick Reference
Angles
Create an Angle from degrees or radians:
final degreesToRadians = Angle.fromDegrees(45);
final radiansToDegrees = Angle.fromRadians(pi / 4);
Retrieve Angle values as degrees or radians:
myAngle.degrees;
myAngle.radians;
Determine an Angle's direction and force it to be positive or negative:
Angles are confined to values in (-360°, 360°). For values beyond this range, the concept of a Rotation is provided.
A Rotation is almost identical to an Angle except that a Rotation can be arbitrarily large in the positive or negative direction. This allows for the accumulation of turns over time.
Create a Rotation:
final rotation = Rotation.fromDegrees(540);
Add, subtract, multiply, and divide Rotations just like Angles.
Reduce a Rotation to an Angle:
Rotation.fromDegrees(540).reduceToAngle();
Polar Coordinates
Define polar coordinates by a radius and an angle, or by a Cartesian point:
// Map to Cartesian coordinates.finalPoint point = PolarCoord(100, Angle.fromDegrees(45)).toCartesian();
Cartesian Orientations
Different use-cases treat angles in different ways.
Mathematics treats the positive x-axis as a 0° angle and treats positive angles as running counter-clockwise.
Flutter app screens treat the positive x-axis as a 0° angle, but then treats positive angles as running clockwise.
Ship navigation treats the positive y-axis as a 0° angle and then treats positive angles as running clockwise.
Each of these situations apply a different orientation when mapping an angle, or a polar coordinate, to a location in Cartesian space. This concept of orientation is supported by superdeclarative_geometry by way of CartesianOrientations.
Both Angle and PolarCoord support CartesianOrientation mappings.
final polarCoord = PolarCoord(100, Angle.fromDegrees(30));
// Treat angles like a Flutter screen.// This point is 30° clockwise from the x-axis.final screenPoint = polarCoord.toCartesian(); // defaults to "screen" orientation// Treat angles like mathematics.// This point is 30° counter-clockwise from the x-axis.final mathPoint = polarCoord.toCartesian(orientation: CartesianOrientation.math);
// Treat angles like navigators.// This point is 30° clockwise from the y-axis.final navigationPoint = polarCoord.toCartesian(orientation: CartesianOrientation.navigation);
You can define a custom CartesianOrientation by implementing the interface. Then, you can pass an instance of your custom orientation into PolarCoord's toCartesian() method.