cssText property

String get cssText

Returns a CSS-formatted dimension string.

The returned string includes the unit and an optional !important suffix. Values are formatted without unnecessary decimal places (e.g., 12px instead of 12.0px).

Example usage:

final dim = Dim.px(12.0, true);
print(dim.cssText); // Output: '12px !important'

Implementation

String get cssText {
  final formattedValue = value == null ? '' : value!.toCleanString;
  final suffix = important ? ' !important' : '';
  return '$formattedValue${unit.trim()}$suffix';
}