SassNumber constructor Null safety

SassNumber(
  1. num value,
  2. [String? unit]
)

Creates a number, optionally with a single numerator unit.

This matches the numbers that can be written as literals. SassNumber.withUnits can be used to construct more complex units.

Implementation

factory SassNumber(num value, [String? unit]) => unit == null
    ? UnitlessSassNumber(value)
    : SingleUnitSassNumber(value, unit);