radiansToLength function Null safety

num radiansToLength(
  1. num radians,
  2. [Unit unit = Unit.kilometers]
)

Implementation

num radiansToLength(num radians, [Unit unit = Unit.kilometers]) {
  var factor = factors[unit];
  if (factor == null) {
    throw Exception("$unit units is invalid");
  }
  return radians * factor;
}