Skip to content

Commit

Permalink
change standard measurments from final to consts - lets them be used …
Browse files Browse the repository at this point in the history
…in constructors
  • Loading branch information
ntatko committed Apr 8, 2024
1 parent f5e0fb0 commit 0c6b6d2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions lib/src/conversion/angle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@ class AngleUnit {
/// A helper class to make units of angle more accessible
class AngleUnits {
/// Angle Unit: Radians: 1 Radian = 57.2958 Degrees
static final AngleUnit radians =
static const AngleUnit radians =
AngleUnit(title: "Radians", identifier: "rad", radianRatio: 1);

/// Angle Unit: Degrees: 1 Degree = 1 Degree
static final AngleUnit degrees =
static const AngleUnit degrees =
AngleUnit(title: "Degrees", identifier: "deg", radianRatio: 180 / pi);

/// Angle Unit: Gradians: 1 Gradian = 0.9 degrees
static final AngleUnit gradians =
static const AngleUnit gradians =
AngleUnit(title: "Gradians", identifier: "grad", radianRatio: 63.662);

/// Angle Unit: Turns: 1 Turn = 360 Degrees
static final AngleUnit turns =
static const AngleUnit turns =
AngleUnit(title: "Turns", identifier: "turn", radianRatio: 0.159155);

/// Angle Unit: Arc Seconds: 1 Arc Second = 1/3600 Degrees
static final AngleUnit arcSeconds =
static const AngleUnit arcSeconds =
AngleUnit(title: "Arc Seconds", identifier: "asec", radianRatio: 206265);

/// Angle Unit: Arc Minutes: 1 Arc Minute = 1/60 Degrees
static final AngleUnit arcMinutes = AngleUnit(
static const AngleUnit arcMinutes = AngleUnit(
title: "Arc Minutes", identifier: "amin", radianRatio: 3437.750002264);

/// Angle Unit: Milliradians: 1 Milliradian = 0.0572958 Degrees
static final AngleUnit milliradians =
static const AngleUnit milliradians =
AngleUnit(title: "Milliradians", identifier: "mrad", radianRatio: 0.001);
}
16 changes: 8 additions & 8 deletions lib/src/conversion/area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@ class AreaUnit {
/// A helper class to make units of area more accessible
class AreaUnits {
/// Area Unit: Square Meters: 1 Square Meter = 1 Square Meter
static final AreaUnit squareMeters =
static const AreaUnit squareMeters =
AreaUnit(title: "Square Meters", identifier: "m2", squareMeterRatio: 1);

/// Area Unit: Square Kilometers: 1 Square Kilometer = 1e-6 Square Meters
static final AreaUnit squareKilometers = AreaUnit(
static const AreaUnit squareKilometers = AreaUnit(
title: "Square Kilometers", identifier: "km2", squareMeterRatio: 1e-6);

/// Area Unit: Square Miles: 1 Square Mile = 3.861e-7 Square Meters
static final AreaUnit squareMiles = AreaUnit(
static const AreaUnit squareMiles = AreaUnit(
title: "Square Miles", identifier: "mi2", squareMeterRatio: 3.861e-7);

/// Area Unit: Acres: 1 Acre = 0.000247105 Square Meters
static final AreaUnit acres =
static const AreaUnit acres =
AreaUnit(title: "Acres", identifier: "ac", squareMeterRatio: 0.000247105);

/// Area Unit: Hectares: 1 Hectare = 1e-4 Square Meters
static final AreaUnit hectares =
static const AreaUnit hectares =
AreaUnit(title: "Hectares", identifier: "ha", squareMeterRatio: 1e-4);

/// Area Unit: Square Feet: 1 Square Foot = 10.7639 Square Meters
static final AreaUnit squareFeet = AreaUnit(
static const AreaUnit squareFeet = AreaUnit(
title: "Square Feet", identifier: "ft2", squareMeterRatio: 10.7639);

/// Area Unit: Square Yards: 1 Square Yard = 1.19599 Square Meters
static final AreaUnit squareYards = AreaUnit(
static const AreaUnit squareYards = AreaUnit(
title: "Square Yards", identifier: "yd2", squareMeterRatio: 1.19599);

/// Area Unit: Square Inches: 1 Square Inch = 1550 Square Meters
static final AreaUnit squareInches = AreaUnit(
static const AreaUnit squareInches = AreaUnit(
title: "Square Inches", identifier: "in2", squareMeterRatio: 1550);
}
18 changes: 9 additions & 9 deletions lib/src/conversion/distance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,38 @@ class DistanceUnit {
/// A helper class to make units more accessible
class DistanceUnits {
/// Distance Unit: Feet: 1 Foot = 0.3048 Meters
static final DistanceUnit feet =
static const DistanceUnit feet =
DistanceUnit(title: "Feet", identifier: "ft", meterRatio: 3.28084);

/// Distance Unit: Yards: 1 Yard = 1.09361 Meters
static final DistanceUnit yards =
static const DistanceUnit yards =
DistanceUnit(title: "Yards", identifier: "yds", meterRatio: 1.09361);

/// Distance Unit: Miles: 1 Mile = 0.000621371 Meters
static final DistanceUnit inches =
static const DistanceUnit inches =
DistanceUnit(title: "Inches", identifier: "in", meterRatio: 39.3701);

/// Distance Unit: Miles: 1 Mile = 1609.34 Meters
static final DistanceUnit nauticalMiles = DistanceUnit(
static const DistanceUnit nauticalMiles = DistanceUnit(
title: "Nautical Miles", identifier: "nm", meterRatio: 0.000539957);

/// Distance Unit: Kilometers: 1 Kilometer = 1000 Meters
static final DistanceUnit kilometers =
static const DistanceUnit kilometers =
DistanceUnit(title: "Kilometers", identifier: "Km", meterRatio: 0.001);

/// Distance Unit: Meters: 1 Meter = 1 Meter
static final DistanceUnit meters =
static const DistanceUnit meters =
DistanceUnit(title: "Meters", identifier: "m", meterRatio: 1);

/// Distance Unit: Centimeters: 1 Centimeter = 100 Meters
static final DistanceUnit centimeters =
static const DistanceUnit centimeters =
DistanceUnit(title: "Centimeters", identifier: "cm", meterRatio: 100);

/// Distance Unit: Millimeters: 1 Millimeter = 1000 Meters
static final DistanceUnit millimeters =
static const DistanceUnit millimeters =
DistanceUnit(title: "Millimeters", identifier: "mm", meterRatio: 1000);

/// Distance Unit: Miles: 1 Mile = 1609.34 Meters
static final DistanceUnit miles =
static const DistanceUnit miles =
DistanceUnit(title: "Miles", identifier: "mi", meterRatio: 0.000621371);
}

0 comments on commit 0c6b6d2

Please sign in to comment.