Skip to content

Property<T> and Subclasses

The abstract Property<T> class is the base for all property types. Each subclass binds a Dart type to a default value, a control, and (via the registry) an editor and JSON converter.

Property

abstract

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
keyStringYesUnique identifier within the collection
labelStringYesDisplay label for the editor
defaultValueTYesInitial value
validatorsList<PropertyValidator>NoValidation rules
helpString?NoHelp text shown below the editor
groupString?NoGroup identifier for sectioning
requiredboolNoAdds a required validator automatically
visibleConditionPropertyCondition?NoCondition for visibility
enabledConditionPropertyCondition?NoCondition for enabled state
customKeyString?NoCustom registry key for editor/converter lookup
metadataMap<String, dynamic>?NoArbitrary metadata

Properties

PropertyTypeDefaultDescription
controlPropertyControl<T>--The reactive control for this property
valueT (get/set)--Current value
visiblebool--Current visibility state
enabledbool--Current enabled state
visibleNotifierValueNotifier<bool>--Visibility notifier for ValueListenableBuilder
hasChangedbool--Whether the value differs from the default

Methods

  • createEditor
    Widget createEditor({required BuildContext context})

    Creates the editor widget via registry lookup.

  • toJson
    dynamic toJson()

    Serializes the value using the registered converter.

  • fromJson
    void fromJson(dynamic json)

    Deserializes the value using the registered converter.

  • getDisplayValue
    String getDisplayValue()

    Returns a human-readable value representation.

  • reset
    void reset()

    Resets to the default value.

  • updateVisibility
    void updateVisibility(bool visible)

    Sets visibility (called by the collection).

  • updateEnabled
    void updateEnabled(bool enabled)

    Sets enabled state (called by the collection).

  • copyWith
    Property<T> copyWith({...})

    Creates a copy with modified parameters.


PropertyControl

abstract

Class Signature

Properties

PropertyTypeDefaultDescription
valueT? (get/set)--Current value
valueChangesStream<T?>--Stream of value changes
disabledbool--Whether the control is disabled
validbool--Whether the control passes validation
hasErrorsbool--Whether there are validation errors
errorsMap<String, dynamic>--Current validation errors

Methods

  • markAsTouched
    void markAsTouched()

    Mark the control as touched (shows errors).

  • markAsUntouched
    void markAsUntouched()

    Mark the control as untouched (hides errors).

  • markAsDisabled
    void markAsDisabled()

    Disable the control.

  • markAsEnabled
    void markAsEnabled()

    Enable the control.

  • reset
    void reset({T? value})

    Reset to a value.

  • focus
    void focus()

    Request focus.

Reactive wrapper around a typed value. Provides value access, validation state, and enabled/disabled control.


PropertyListControl

abstract

Class Signature

Properties

PropertyTypeDefaultDescription
itemsList<T>--Current items
lengthint--Number of items
valueChangesStream<List<T?>?>--Stream of list changes
itemControlsList<PropertyControl<T>>--Per-item reactive controls

Methods

  • add
    void add(T item)

    Append an item.

  • removeAt
    void removeAt(int index)

    Remove the item at the given index.

  • insert
    void insert(int index, T item)

    Insert an item at the given position.

  • move
    void move(int oldIndex, int newIndex)

    Reorder items.

  • clear
    void clear()

    Remove all items.

  • replaceAt
    void replaceAt(int index, T item)

    Replace the item at the given position.

Reactive control for list properties.


PropertyEditor

abstract

Class Signature

Methods

  • createEditor
    Widget createEditor({required BuildContext context, required PropertyControl<T> control, required String label, required String name, String? help})

    Creates a Flutter widget for editing a property value.

Interface for property editor implementations. Each property type has a registered editor in PropertySystem.


Built-in Concrete Properties

The following concrete subclasses cover the basic Dart types. Each has a single-argument constructor that omits explicit configuration; the table below summarizes the type, default value, and builder shorthand.

ClassDart TypeDefault ValueBuilder Shorthand
StringPropertyString''b.string(key, label, ...)
IntPropertyint0b.integer(key, label, ...)
DoublePropertydouble0.0b.decimal(key, label, ...)
BoolPropertyboolfalseb.boolean(key, label, ...)
DateTimePropertyDateTimeDateTime.now()b.dateTime(key, label, ...)

DateTimeProperty overrides getDisplayValue() to return a formatted date string.

Optional Variants

Optional variants accept null and provide a convenience getter that returns a fallback value.

ClassTypeDefaultBuilderFallback Getter
OptionalStringPropertyString?nulloptionalText()stringValue -> ''
OptionalIntPropertyint?nulloptionalInteger()intValue -> 0
OptionalDoublePropertydouble?nulloptionalDecimal()doubleValue -> 0.0
OptionalBoolPropertybool?nulloptionalBoolean()--
OptionalDateTimePropertyDateTime?nulloptionalDateTime()--

EnumProperty

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
optionsList<EnumOption<T>>YesList of selectable options
defaultValueT?NoDefaults to first option if not specified

EnumOption<T>

PropertyTypeDefaultDescription
valueT--The typed value
titleString--Display label
descriptionString?--Optional description

Notes

Auto-registers EnumOptionsJsonConverter<T> on construction. Builder shorthand: b.enumeration<T>(key, label, options:, defaultValue:).

A property that constrains the value to one of a typed list of options.


ListProperty

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
getItemIdString Function(T)?NoID extractor for stable keys
maxItemsint?NoMaximum number of items
minItemsint?NoMinimum number of items

Methods

  • items
    List<T> get items

    Current list of values.

  • listControl
    PropertyListControl<T> get listControl

    Underlying list control for advanced operations.

  • add
    void add(T item)

    Append an item.

  • remove
    void remove(T item)

    Remove by value.

  • removeAt
    void removeAt(int index)

    Remove by index.

  • insert
    void insert(int index, T item)

    Insert an item at the given position.

  • move
    void move(int oldIndex, int newIndex)

    Reorder items.

  • replaceAt
    void replaceAt(int index, T item)

    Replace at position.

  • clear
    void clear()

    Remove all items.

A property whose value is a list of typed items.


UnionProperty

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
optionsList<UnionOption>YesList of union options
defaultSelectedKeyStringYesKey of the initially selected option

Properties

PropertyTypeDefaultDescription
selectedKeyString--Currently selected option key
selectedPropertyProperty?--Currently selected option's property
selectedOptionUnionOption?--Currently selected option

Methods

  • selectOption
    void selectOption(String key)

    Change the selected option.

UnionOption

PropertyTypeDefaultDescription
keyString--Unique option key
titleString--Display label
descriptionString?--Optional description
propertyProperty--The property for this option
iconWidget?--Optional icon
metadataMap<String, dynamic>?--Arbitrary metadata

JSON Format

A UnionProperty serializes to a map with two keys: "selectedKey" identifying the chosen option and "selectedValue" carrying that option's serialized value, e.g. {"selectedKey": "fixed", "selectedValue": "2026-04-01"}.

A discriminated-union property whose value is the selected option's key. Each option carries its own nested Property.


ReadOnlyProperty

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
formatterString Function(T)?NoCustom display formatter

Properties

PropertyTypeDefaultDescription
displayValueString--Formatted display string

Notes

Uses a customKey of readonly:<type> (e.g. readonly:string) to select a read-only editor from the registry. Builder shorthand: b.readonly<T>(key, label, defaultValue:).

A property whose value cannot be edited by the user. Useful for derived, computed, or system-set values.

Next Steps