Property System
A standalone, type-safe property system for dynamic object configuration in Flutter. Provides generic Property<T> wrappers, built-in editors for common types, validation, conditional visibility, JSON serialization, and reactive_forms integration -- no vyuh_core dependency required.
Key Capabilities
Type-Safe Properties
Generic Property<T> wrappers with metadata, validation, and JSON serialization. No stringly-typed configuration.
Built-in Property Editors
Pre-built editors for String, Int, Double, Bool, DateTime, Enum, List, Union, and ReadOnly properties with optional-value variants.
Validation & Conditions
PropertyValidator<T> for validation rules. PropertyCondition for reactive visibility and enabled state based on other property values.
JSON Serialization
JsonConverter<T> system with a type-to-converter registry for automatic serialization and deserialization of property values.
Getting Started
Core Concepts
Core Components
| Component | Description |
|---|---|
| Property<T> | Generic property wrapper with key, label, default value, validation, and conditions |
| PropertyControl<T> | Typed control abstraction over reactive_forms FormControl, with value, validation, and enabled state |
| PropertyCollection | Groups properties with reactive_forms FormGroup, conditional visibility, and change tracking |
| PropertyCollectionBuilder | Fluent builder for constructing property groups and properties with less boilerplate |
| PropertyCollectionEditor | Flutter widget that renders a property collection as an editable form |
| PropertyCondition | Conditional visibility/enabled state (equals, in, comparison, and/or, custom) |
| PropertyValidator<T> | Validation rules with required, min, max, pattern, email, and custom validators |
| JsonConverter<T> | Type-safe serialization/deserialization with type-to-converter registry |
Learn More
Quick Example
Build a course settings panel using the fluent PropertyCollectionBuilder:
import 'package:vyuh_property_system/vyuh_property_system.dart';
// Define course level options
enum CourseLevel { beginner, intermediate, advanced }
// Build the property collection
final builder = PropertyCollectionBuilder()
..group('basic', 'Basic Info')
..string('title', 'Course Title', required: true)
..string('description', 'Description')
..integer('duration', 'Duration (hours)', defaultValue: 1,
validators: [PropertyValidators.min(1)])
..group('enrollment', 'Enrollment')
..enumeration<CourseLevel>('level', 'Course Level',
options: [
EnumOption(CourseLevel.beginner, 'Beginner'),
EnumOption(CourseLevel.intermediate, 'Intermediate'),
EnumOption(CourseLevel.advanced, 'Advanced'),
],
defaultValue: CourseLevel.beginner)
..boolean('enrollmentOpen', 'Open Enrollment', defaultValue: true)
..integer('capacity', 'Max Capacity', defaultValue: 30,
visibleCondition: PropertyCollectionBuilder.whenTrue('enrollmentOpen'));
final collection = builder.buildCollection();
// Render as an editable form
PropertyCollectionEditor(collection: collection);
// Read values and serialize
print(collection.getValue<String>('title'));
print(collection.toJson());Built-in Property Types
| Property | Builder Method | Description |
|---|---|---|
StringProperty | string() | Text value with string editor |
IntProperty | integer() | Integer value with number editor |
DoubleProperty | decimal() | Decimal value with number editor |
BoolProperty | boolean() | Boolean value with toggle editor |
DateTimeProperty | dateTime() | Date/time value with picker editor |
EnumProperty<T> | enumeration() | Enum selection from typed options |
ListProperty<T> | list() | List of typed values with reordering |
UnionProperty | (direct) | Select one property from multiple options |
ReadOnlyProperty<T> | readonly() | Display-only, non-editable value |
Each type also has an optional variant (e.g., OptionalStringProperty / optionalText()) for nullable values.