extractComponentKeys function

Set<String> extractComponentKeys(
  1. FFNode node
)

Extract component keys used within a node tree.

Traverses the node tree recursively to find all component references.

Implementation

Set<String> extractComponentKeys(FFNode node) {
  final componentKeys = <String>{};

  void traverse(FFNode current) {
    if (current.isComponent && current.hasComponentClassKeyRef()) {
      componentKeys.add(current.componentClassKeyRef.key);
    }
    for (final child in current.children) {
      traverse(child);
    }
  }

  traverse(node);
  return componentKeys;
}