discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

entryOfInstance function

SymbolEntry? entryOfInstance(
  1. SymbolLibrary library,
  2. DraftDocument doc,
  3. Handle instance
)

instance's library entry (V-5): the exact key@version of its definition's SymbolComponent, else the key's highest version; null when the library has neither.

Implementation

SymbolEntry? entryOfInstance(
    SymbolLibrary library, DraftDocument doc, Handle instance) {
  final node = doc.tree[instance];
  if (node is! InstanceNode) return null;
  final c = doc.components.get<SymbolComponent>(node.definition);
  if (c == null) return null;
  SymbolEntry? highest;
  for (final e in library.entries) {
    if (e.key != c.key) continue;
    if (e.version == c.version) return e;
    if (highest == null || e.version > highest.version) highest = e;
  }
  return highest;
}