SpecEditor class
Generic, typed, meta-validated editing over a SpecDocument.
Constructors
- SpecEditor(SpecDocument document, SpecReflection reflection)
-
Takes an already-built
reflection, for the caller that holds one (a query engine, a validator) and would otherwise pay for a second model walk. When only aSpecModelis at hand use SpecEditor.forModel; the two differ in nothing else. Neither checks thatdocumentwas built against the same model — a mismatch surfaces as ArgumentError on the first path that fails to resolve. - SpecEditor.forModel(SpecDocument document, SpecModel model)
-
Convenience: builds the editor for
documentovermodel.
Properties
- document → SpecDocument
-
The document being edited (the sparse value stores).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- reflection → SpecReflection
-
The value-free meta-model queries the editor validates against.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListItem(
String listPath, {String? sectionId, DateTime? now}) → String -
Appends a new item to the list at
listPathand returns its stable item path. -
clearSection(
String path) → void -
Clears every value at
pathand beneath it — content, form entries, nested list items, stored headlines and ids — returning the subtree to the untouched "empty = no value" state (D4). The node itself remains addressable (structure lives in the model, not the document). -
formFields(
String path) → List< FormFieldSpec> -
The form-field specs of the
@Formsection atpath, in declaration order — the meta a generic editor UI renders from. -
formValue(
String path, String field) → Object? -
The typed value of form
fieldat the@Formsectionpath, ornullwhen unset. -
headline(
String path) → String? -
The stored headline at
path, ornullwhen the section renders its effective default title. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeListItem(
String itemPath) → bool -
Removes the list item at
itemPathwith every value beneath it. Returnstruewhen an item was found and removed. -
resolve(
String path) → SpecResolution -
Resolves
pathagainst the meta-model, throwing ArgumentError for a dangling path — the strict companion to SpecReflection.resolve. -
setFormValue(
String path, String field, Object? v) → void -
Sets form
fieldat the@Formsectionpathto the typed valuev(nullclears), converting through the shared boundary helpers. -
setHeadline(
String path, String? value) → void -
Sets the stored headline at
path; empty/nullreturns the section to its default title. -
setValue(
String path, Object? v) → void -
Sets the value leaf at
pathtov, converting at the store boundary. -
toString(
) → String -
A string representation of this object.
inherited
-
value(
String path) → Object? -
The typed value at the value leaf
path, ornullwhen unset.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited