cssExpression property

  1. @override
String get cssExpression

Shorthand CSS format for font is:

font-style font-variant font-weight font-size/line-height font-family

The font-size and font-family values are required. If any of the other values are missing the default value is used.

Implementation

@override
String get cssExpression {
  // TODO(jimhug): include variant, style, other options
  if (weight != null) {
    // TODO(jacobr): is this really correct for lineHeight?
    if (lineHeight != null) {
      return '$weight ${size}px/$lineHeightInPixels $_fontsAsString';
    }
    return '$weight ${size}px $_fontsAsString';
  }

  return '${size}px $_fontsAsString';
}