addPropertyAtDepth method
Implementation
CrawledBlock addPropertyAtDepth(CrawledProperty property, int depth) {
assert(depth >= 0);
assert(depth == 0 || nestedBlocks.isNotEmpty);
if (depth == 0) {
return copyWith(
properties: [...properties, property],
);
}
return copyWith(
nestedBlocks: [
...(nestedBlocks.length > 1
? nestedBlocks.sublist(0, nestedBlocks.length - 1)
: []),
nestedBlocks.last.addPropertyAtDepth(property, depth - 1),
],
);
}