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< directives)V> > -
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< ? directives})V> > -
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<
Returns the absolute value.T> , provided by the NumberPropDirectiveExt extension -
add(
num addend) → Prop< num> -
Available on Prop<
AddsT> , provided by the NumberPropDirectiveExt extensionaddendto the resolved value. -
ceil(
) → Prop< num> -
Available on Prop<
Ceils the value (rounds up).T> , provided by the NumberPropDirectiveExt extension -
clamp(
num min, num max) → Prop< num> -
Available on Prop<
Clamps the resolved value betweenT> , provided by the NumberPropDirectiveExt extensionminandmax. -
directives(
List< Directive< directives) → Prop<V> >V> - Returns a new property with the given directives merged with existing ones.
-
divide(
num divisor) → Prop< num> -
Available on Prop<
Divides the resolved value byT> , provided by the NumberPropDirectiveExt extensiondivisor. -
floor(
) → Prop< num> -
Available on Prop<
Floors the value (rounds down).T> , provided by the NumberPropDirectiveExt extension -
mergeProp(
covariant Prop< V> ? other) → Prop<V> - Merges this property with another property.
-
multiply(
num factor) → Prop< num> -
Available on Prop<
Multiplies the resolved value byT> , provided by the NumberPropDirectiveExt extensionfactor. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
round(
) → Prop< num> -
Available on Prop<
Rounds to the nearest integer (returns double).T> , provided by the NumberPropDirectiveExt extension -
scale(
num ratio) → Prop< num> -
Available on Prop<
Alias for multiply - scales the value byT> , provided by the NumberPropDirectiveExt extensionratio. -
subtract(
num subtrahend) → Prop< num> -
Available on Prop<
SubtractsT> , provided by the NumberPropDirectiveExt extensionsubtrahendfrom 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.