Skip to main content

Nested Objects

From nested_example.dart, Zorphy handles nested entities, self-references, and nested patching.


abstract class $Person {
String get name;
int get age;
$Address get address;
}

Nested patching

final personPatch = PersonPatch.create()
..withAddressPatch(AddressPatch.create()..withCity('Los Angeles'));

final updated = person.patchWithPerson(patchInput: personPatch);

Self-referencing trees

(generateJson: true)
abstract class $CategoryNode {
String get id;
String get name;
List<$CategoryNode>? get children;
$CategoryNode? get parent;
}