SassCalculation class Null safety Value

A SassScript calculation.

Although calculations can in principle have any name or any number of arguments, this class only exposes the specific calculations that are supported by the Sass spec. This ensures that all calculations that the user works with are always fully simplified.



arguments List<Object>
The calculation's arguments.
asList List<Value>
This value as a list.
read-only, inherited
hasBrackets bool
Whether this value as a list has brackets.
read-only, inherited
hashCode int
The hash code for this object.
read-only, override
isTruthy bool
Whether the value counts as true in an @if statement and other contexts.
read-only, inherited
name String
The calculation's name, such as "calc".
realNull Value?
Returns Dart's null value if this is sassNull, and returns this otherwise.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
separator ListSeparator
The separator for this value as a list.
read-only, inherited


assertBoolean([String? name]) SassBoolean
Throws a SassScriptException if this isn't a boolean.
assertCalculation([String? name]) SassCalculation
Throws a SassScriptException if this isn't a calculation.
assertColor([String? name]) SassColor
Throws a SassScriptException if this isn't a color.
assertFunction([String? name]) SassFunction
Throws a SassScriptException if this isn't a function reference.
assertMap([String? name]) SassMap
Throws a SassScriptException if this isn't a map.
assertNumber([String? name]) SassNumber
Throws a SassScriptException if this isn't a number.
assertString([String? name]) SassString
Throws a SassScriptException if this isn't a string.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
sassIndexToListIndex(Value sassIndex, [String? name]) int
Converts sassIndex into a Dart-style index into the list returned by asList.
toCssString({bool quote = true}) String
Returns a valid CSS representation of this.
toString() String
Returns a string representation of this.
tryMap() SassMap?
Returns this as a SassMap if it is one (including empty lists, which count as empty maps) or returns null if it's not.
withListContents(Iterable<Value> contents, {ListSeparator? separator, bool? brackets}) SassList
Returns a new list containing contents that defaults to this value's separator and brackets.


operator ==(Object other) bool
The equality operator.

Static Methods

calc(Object argument) Value
Creates a calc() calculation with the given argument.
clamp(Object min, [Object? value, Object? max]) Value
Creates a clamp() calculation with the given min, value, and max.
max(Iterable<Object> arguments) Value
Creates a max() calculation with the given arguments.
min(Iterable<Object> arguments) Value
Creates a min() calculation with the given arguments.
operate(CalculationOperator operator, Object left, Object right) Object
Creates and simplifies a CalculationOperation with the given operator, left, and right.
operateInternal(CalculationOperator operator, Object left, Object right, {required bool inMinMax}) Object
Like operate, but with the internal-only inMinMax parameter.