flattenContainer method
Returns the flattened fragment list for container with global
offsets, using the document cache when available.
Implementation
List<(Fragment, int, int)> flattenContainer(FNode container) {
_flattenedCache ??= {};
_flattenedByFragIdCache ??= {};
final cid = container.id;
final cached = _flattenedCache![cid];
if (cached != null) return cached;
final result = flattenFragmentsSimple(container);
_flattenedCache![cid] = result;
final byId = <String, (Fragment, int, int)>{};
for (final (frag, start, end) in result) {
byId[frag.id] = (frag, start, end);
}
_flattenedByFragIdCache![cid] = byId;
return result;
}