Value class abstract

A SassScript value.

All SassScript values are unmodifiable. New values can be constructed using subclass constructors like SassString.new. Untyped values can be cast to particular types using assert*() functions like assertString, which throw user-friendly error messages if they fail.

Available extensions
Annotations
  • @sealed

Properties

asList List<Value>
This value as a list.
no setter
hasBrackets bool
Whether this value as a list has brackets.
no setter
hashCode int
The hash code for this object.
no setterinherited
isTruthy bool
Whether the value counts as true in an @if statement and other contexts.
no setter
realNull Value?
Returns Dart's null value if this is sassNull, and returns this otherwise.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
separator ListSeparator
The separator for this value as a list.
no setter

Methods

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.
assertComplexSelector({String? name, bool allowParent = false}) ComplexSelector

Available on Value, provided by the SassApiValue extension

Parses this as a complex selector, in the same manner as the selector-parse() function.
assertCompoundSelector({String? name, bool allowParent = false}) CompoundSelector

Available on Value, provided by the SassApiValue extension

Parses this as a compound selector, in the same manner as the selector-parse() function.
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.
assertMixin([String? name]) SassMixin
Throws a SassScriptException if this isn't a mixin reference.
assertNumber([String? name]) SassNumber
Throws a SassScriptException if this isn't a number.
assertSelector({String? name, bool allowParent = false}) SelectorList

Available on Value, provided by the SassApiValue extension

Parses this as a selector list, in the same manner as the selector-parse() function.
assertSimpleSelector({String? name, bool allowParent = false}) SimpleSelector

Available on Value, provided by the SassApiValue extension

Parses this as a simple selector, in the same manner as the selector-parse() function.
assertString([String? name]) SassString
Throws a SassScriptException if this isn't a string.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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.
override
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.

Operators

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