PropDef<T> class final

One prop of a widget.

Annotations
  • @immutable

Constructors

PropDef(String key, PropCodec<T> codec, T defaultValue, {String doc = '', bool required = false})
const

Properties

codec → PropCodec<T>
final
defaultValue → T
Flutter's default. Values equal to it aren't stored.
final
doc → String
final
hashCode → int
The hash code for this object.
no setterinherited
key → String
The JSON key: Flutter's parameter name.
final
nullable → bool
Whether the prop may be unset (null: the widget's own default).
no setter
required → bool
A component parameter the call must set (Flutter's required): a call sets it. The core's own props are never required.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → PropType
What the prop holds.
no setter

Methods

coerce(Object? value) → T?
value as this prop's declared type: as is when it has it, else read by the codec (an int for a double prop is that double, a JSON value is decoded). A call site can infer a wider type than declared (withProp(FlexProps.spacing, 31) infers num), so a value is checked against the declaration, not the call. Throws an ArgumentError for a value the codec can't read.
decode(Object? json) → T?
encode(T value) → Object?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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