convertAngle method

double convertAngle({
  1. AngleUnit from = AngleUnit.radian,
  2. AngleUnit to = AngleUnit.radian,
})

Converts this double value from one angle unit to another.

Set the source unit using from and the target unit using to. The default unit is AngleUnit.radian for both of them.

Examples:

// from degrees to radians
90.0.convertAngle(from: AngleUnit.degree); // ~1.5708

// from radians to degrees
1.5708.convertAngle(to: AngleUnit.degree); // ~90.0

See also AngleUnit for unit types and conversion implementations.

Implementation

double convertAngle({
  AngleUnit from = AngleUnit.radian,
  AngleUnit to = AngleUnit.radian,
}) =>
    from.toUnit(toDouble(), to);