changedPaths property
The JSON pointers this patch changes, e.g. {'/price', '/title'}.
Each touched field contributes /<field>. A nested field carries a
PatchNested whose own sub-patch is a PatchBase; its leaf paths are
expanded under the field, so /address/street and /address/city are
distinct paths and two edits under one object conflict only on the leaf
they share. A whole-value transition (a null on either side, or a fluent
with* builder that wrote a raw value) is the field path itself.
Implementation
Set<String> get changedPaths {
final paths = <String>{};
patchMap.forEach((key, value) {
final name = wireNameFor(key);
final nested = value is PatchNested ? value.patch : null;
if (nested is PatchBase) {
final child = nested.changedPaths;
if (child.isEmpty) {
paths.add('/$name');
} else {
for (final path in child) {
paths.add('/$name$path');
}
}
} else {
paths.add('/$name');
}
});
return paths;
}