to method

double to(
  1. LengthUnit unit,
  2. num value
)

Implementation

double to(final LengthUnit unit,final num value) {
    if(unit.scaleFactor == scaleFactor) {
        return value;
    }

    // Convert to primary unit.
    final double primaryValue = value / scaleFactor;

    // Convert to destination unit.
    return primaryValue * unit.scaleFactor;
}