parseAngle static method

double? parseAngle(
  1. String rawAngleValue
)

Implementation

static double? parseAngle(String rawAngleValue) {
  if (_cachedParsedAngle.containsKey(rawAngleValue)) {
    return _cachedParsedAngle[rawAngleValue];
  }
  double? angleValue;
  if (rawAngleValue.endsWith(_DEG)) {
    angleValue = double.tryParse(rawAngleValue.split(_DEG)[0])! * 2 * math.pi / 360;
  } else if (rawAngleValue.endsWith(_GRAD)) {
    angleValue = double.tryParse(rawAngleValue.split(_GRAD)[0])! * 2 * math.pi / 400;
  } else if (rawAngleValue.endsWith(_RAD)) {
    angleValue = double.tryParse(rawAngleValue.split(_RAD)[0]);
  } else if (rawAngleValue.endsWith(_TURN)) {
    angleValue = double.tryParse(rawAngleValue.split(_TURN)[0])! * 2 * math.pi;
  }

  return  _cachedParsedAngle[rawAngleValue] = angleValue;
}