Prop<V> class

A property that can hold values, tokens, or Mix types.

Prop is the foundation of the Mix styling system. It provides:

  • Storage for values through different source types
  • Token resolution via BuildContext
  • Merging capabilities with different strategies
  • Directive application for value transformations
  • Animation configuration support

This class serves as the base for both regular and Mix properties, consolidating the previous PropBase hierarchy into a single implementation.

Value Creation

Use Prop.value for regular values - it creates a ValueSource without conversion. Use Prop.mix for explicit Mix values - it creates a MixSource.

Conversion Behavior

Type conversion to Mix types happens ONLY during resolution when Mix values are present in the property. Prop.value never auto-converts values.

Available extensions
Annotations

Constructors

Prop.directives(List<Directive<V>> directives)
Creates a property with only directives.
const
Prop.fromProp(Prop<V> other)
Creates a new property by copying all fields from another property.
Prop.token(MixToken<V> token, {List<Directive<V>>? directives})
Creates a property that references a token.
factory

Properties

$directives List<Directive<V>>?
Optional directives to transform the resolved value.
final
hashCode int
The hash code for this object.
no setteroverride
hasToken bool
Whether this property contains at least one token source.
no setter
hasValue bool
Whether this property contains at least one value source.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sources List<PropSource<V>>
The list of sources that provide values for this property.
final
type Type
The runtime type of the property's value.
no setter

Methods

abs() Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Returns the absolute value.
add(num addend) Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Adds addend to the resolved value.
ceil() Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Ceils the value (rounds up).
clamp(num min, num max) Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Clamps the resolved value between min and max.
directives(List<Directive<V>> directives) Prop<V>
Returns a new property with the given directives merged with existing ones.
divide(num divisor) Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Divides the resolved value by divisor.
floor() Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Floors the value (rounds down).
mergeProp(covariant Prop<V>? other) Prop<V>
Merges this property with another property.
multiply(num factor) Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Multiplies the resolved value by factor.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
round() Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Rounds to the nearest integer (returns double).
scale(num ratio) Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Alias for multiply - scales the value by ratio.
subtract(num subtrahend) Prop<num>

Available on Prop<T>, provided by the NumberPropDirectiveExt extension

Subtracts subtrahend from the resolved value.
toString() String
A string representation of this object.
override

Operators

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

Static Methods

maybe<V>(V? value) Prop<V>?
Creates a property from a nullable value.
maybeMix<V>(Mix<V>? value) Prop<V>?
Creates a property from a nullable Mix value.
mix<V>(Mix<V> mix) Prop<V>
Creates a property from a Mix value.
mixValue<V>(V value) Prop<V>?
Creates a property from a regular value by converting it to a Mix.
value<V>(V value) Prop<V>
Creates a property from a direct value.