PropertyCollection, Builder, Editor, Derivation
PropertyCollection
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groups | List<PropertyGroup> | No | Initial groups (an auto-created general group is added if needed) |
properties | List<Property> | No | Initial properties — validated against declared groups on construction |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
properties | List<Property> | -- | All properties in insertion order |
groups | List<PropertyGroup> | -- | All groups (including the auto-created general group) |
values | Map<String, dynamic> | -- | Current values snapshot |
valueChanges | Stream<Map<String, dynamic>?> | -- | Stream of all value changes |
length | int | -- | Property count |
isEmpty | bool | -- | Whether the collection has no properties |
isNotEmpty | bool | -- | Whether the collection has properties |
isValid | bool | -- | Whether all properties pass validation |
hasChanges | bool | -- | Whether any value differs from its default |
validationErrors | List<String> | -- | Error messages for invalid properties |
Methods
getPropertyProperty? getProperty(String key)Get a property by key.
hasPropertybool hasProperty(String key)Check whether a property exists.
getValueT getValue<T>(String key)Type-safe value access (throws on type mismatch).
setValuevoid setValue<T>(String key, T value)Type-safe value set.
getPropertiesByGroupList<Property> getPropertiesByGroup(String value)Get the properties belonging to a group.
getGroupByValuePropertyGroup? getGroupByValue(String value)Get a specific group.
hasGroupbool hasGroup(String groupValue)Check whether a group exists.
addPropertyvoid addProperty(Property property)Add a single property.
addPropertiesvoid addProperties(List<Property> properties)Add multiple properties efficiently — sets up reactions once.
removePropertyvoid removeProperty(String key)Remove a property by key.
addGroupvoid addGroup(PropertyGroup group)Add a group.
addGroupsvoid addGroups(List<PropertyGroup> groups)Add multiple groups.
removeGroupvoid removeGroup(String groupValue)Remove a group.
clearGroupsvoid clearGroups()Remove all groups.
clearvoid clear()Remove all properties and dispose reactions.
validateAllMap<String, String> validateAll()Returns error messages keyed by property key.
toJsonMap<String, dynamic> toJson()Returns a map of all property values.
fromJsonvoid fromJson(Map<String, dynamic> json)Restore values from a JSON map.
resetAllvoid resetAll()Reset all properties to their default values.
clonePropertyCollection clone()Deep clone the collection.
copyFromvoid copyFrom(PropertyCollection other)Replace contents with those of another collection.
addDerivationsvoid addDerivations(List<PropertyDerivation> list)Register derivation rules and wire subscriptions.
markDerivationsAsDirtyvoid markDerivationsAsDirty()Mark all derivations as user-edited (skips auto-derivation).
createEditorPropertyCollectionEditor createEditor({required BuildContext context, bool showGroups, bool shrinkwrap, bool scrollable, bool disposeCollection})Create a PropertyCollectionEditor widget.
createSingleLineEditorWidget createSingleLineEditor({required BuildContext context, List<int>? flexValues})Create a horizontal row of editors.
setupReactionsvoid setupReactions()Set up condition evaluation (called automatically).
disposevoid dispose()Cancel all subscriptions.
Container for properties with shared validation, condition evaluation, serialization, and UI rendering.
PropertyGroup
Class Signature
Properties
| Property | Type | Default | Description |
|---|---|---|---|
value | String | -- | Unique identifier |
title | String | -- | Display title |
collapsible | bool | true | Whether the group can be collapsed |
initiallyCollapsed | bool | false | Whether to start collapsed |
showHeader | bool | true | Whether to show the group header |
Factory Constructors
PropertyGroup.collapsiblePropertyGroup.collapsible({required String value, required String title, bool initiallyCollapsed = false})Collapsible group rendered as an ExpansionTile.
PropertyGroup.fixedPropertyGroup.fixed({required String value, required String title, bool showHeader = true})Non-collapsible group.
PropertyGroup.generalPropertyGroup.general({String title = 'General', bool showHeader = true})Auto-created group for ungrouped properties.
Configuration for how a property group is displayed.
PropertyCollectionBuilder
Class Signature
Methods
groupPropertyCollectionBuilder group(String value, String title, {bool collapsible, bool initiallyCollapsed})Start a group context — subsequent properties belong to this group until endGroup().
endGroupPropertyCollectionBuilder endGroup()End the current group context.
stringStringProperty string(String key, String label, {...})Add a string property.
optionalTextOptionalStringProperty optionalText(String key, String label, {...})Add a nullable string property.
integerIntProperty integer(String key, String label, {...})Add an integer property.
optionalIntegerOptionalIntProperty optionalInteger(String key, String label, {...})Add a nullable integer property.
decimalDoubleProperty decimal(String key, String label, {...})Add a double property.
optionalDecimalOptionalDoubleProperty optionalDecimal(String key, String label, {...})Add a nullable double property.
booleanBoolProperty boolean(String key, String label, {...})Add a boolean property.
optionalBooleanOptionalBoolProperty optionalBoolean(String key, String label, {...})Add a nullable boolean property.
dateTimeDateTimeProperty dateTime(String key, String label, {...})Add a DateTime property.
optionalDateTimeOptionalDateTimeProperty optionalDateTime(String key, String label, {...})Add a nullable DateTime property.
enumerationEnumProperty<T> enumeration<T>(String key, String label, {required List<EnumOption<T>> options, T? defaultValue, ...})Add an enum property.
listListProperty<T> list<T>(String key, String label, {...})Add a list property.
readonlyReadOnlyProperty<T> readonly<T>(String key, String label, {required T defaultValue, ...})Add a read-only property.
derivedPropertyPropertyCollectionBuilder derivedProperty(String target, {required Set<String> from, required Function transformer, bool initiallyDirty = false})Add a derivation rule that auto-computes the target property from source properties.
buildCollectionPropertyCollection buildCollection()Build the complete collection with groups and derivations.
buildListList<Property> buildList()Build only the property list (without groups).
Static Condition Helpers
whenstatic EqualsCondition<T> when<T>(String key, T value)Equals condition shorthand.
whenNotstatic NotEqualsCondition<T> whenNot<T>(String key, T value)Not-equals condition shorthand.
whenInstatic InCondition<T> whenIn<T>(String key, Set<T> values)In-set condition shorthand.
whenNotInstatic NotInCondition<T> whenNotIn<T>(String key, Set<T> values)Not-in-set condition shorthand.
whenTruestatic EqualsCondition<bool> whenTrue(String key)Equals true (boolean) condition.
whenFalsestatic EqualsCondition<bool> whenFalse(String key)Equals false (boolean) condition.
whenHasValuestatic HasValueCondition whenHasValue(String key)Property has a non-null value.
whenAllstatic AndCondition whenAll(List<PropertyCondition> conditions)All child conditions must be true.
whenAnystatic OrCondition whenAny(List<PropertyCondition> conditions)Any child condition must be true.
whenGreaterThanstatic ComparisonCondition<T> whenGreaterThan<T extends num>(String key, T value)Numeric greater-than condition.
whenLessThanstatic ComparisonCondition<T> whenLessThan<T extends num>(String key, T value)Numeric less-than condition.
whenCustomstatic CustomCondition whenCustom({required List<String> dependencies, required bool Function(PropertyCollection) evaluator})Custom condition with explicit dependencies.
Fluent builder for constructing PropertyCollection instances.
PropertyCollectionEditor
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
collection | PropertyCollection | Yes | The collection to render |
onChanged | VoidCallback? | No | Called on any value change |
showGroups | bool | No | Whether to render group headers |
shrinkWrap | bool | No | Whether to shrink-wrap the list |
scrollable | bool | No | Whether to enable scrolling |
disposeCollection | bool | No | Whether to dispose the collection on widget dispose |
Widget that renders a PropertyCollection as an editable form.
PropertyDerivation
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
targetProperty | String | Yes | Key of the property to auto-compute |
sourceProperties | Set<String> | Yes | Keys of source properties to watch |
transformer | dynamic Function(Map<String, dynamic>) | Yes | Computes the target value from current source values |
initiallyDirty | bool | No | Skip derivation on initialization |
Behavior
A change in any source property triggers the transformer. If the user manually edits the target, derivation stops (the property becomes "dirty"). Clearing the target resumes derivation. Call collection.markDerivationsAsDirty() after loading data to prevent auto-derivation from overwriting loaded values.
Defines how a target property's value is auto-computed from source properties.
Next Steps
- Property<T> API -- Property and control reference
- Conditions API -- All condition types
- Glossary -- Terms and definitions