expressionToLineHeight static method

LineHeight expressionToLineHeight(
  1. Expression value
)

Implementation

static LineHeight expressionToLineHeight(css.Expression value) {
  if (value is css.NumberTerm) {
    return LineHeight.number(double.tryParse(value.text)!);
  } else if (value is css.PercentageTerm) {
    return LineHeight.percent(double.tryParse(value.text)!);
  } else if (value is css.EmTerm) {
    return LineHeight.em(double.tryParse(value.text)!);
  } else if (value is css.RemTerm) {
    return LineHeight.rem(double.tryParse(value.text)!);
  } else if (value is css.LengthTerm) {
    return LineHeight(double.tryParse(value.text.replaceAll(RegExp(r'\s+(\d+\.\d+)\s+'), '')), units: "length");
  }
  return LineHeight.normal;
}