graph/ff_project_graph library

Shared project graph infrastructure for FlutterFlow.

The Project Graph is a queryable index of project knowledge that enables intelligent features across FlutterFlow - incremental codegen, error detection, AI context building, and more.

Core Concept

Every feature that needs to understand a FlutterFlow project asks: "What is the relevant context for X?"

The graph answers this with surgical precision through queries like:

  • getDependents(nodeId) - What depends on this node?
  • getDependencies(nodeId) - What does this node depend on?
  • getContext(nodeId, depth) - What's the relevant context around this node?

Usage

// Build graph from project
final graph = ProjectGraph.fromProject(project);

// Query for dependents
final affected = graph.getDependents('widgetClass:homePageKey');

// Apply incremental update
graph.applyUpdate(projectUpdate);

Classes

ActionBlockDependencies
Tracks dependencies of an action block (FFActionComponent) on other custom code entities.
DependencyNode
Represents a node in the project dependency graph.
GlobalNodeIds
Global file node IDs - constants for well-known global nodes.
GraphBuilder
Builds a ProjectGraph from an FFProject.
GraphUpdater
Incrementally updates a ProjectGraph based on project changes.
NodeIds
Helper functions for generating and parsing node IDs.
ProjectGraph
A graph of dependencies between widget classes and global files in a project.
WidgetClassGlobalDependencies
Tracks which global resources a widget class actually uses.

Enums

DependencyNodeType
Type of node in the project dependency graph.

Extensions

DependencyNodeTypeExtension on DependencyNodeType
Extension to check node type categories.

Functions

extractComponentKeys(FFNode node) Set<String>
Extract component keys used within a node tree.
extractComponentRefs(FFNode node) Set<ComponentRef>
Extract structured component references from a node tree.

Typedefs

ComponentRef = ({String key, String? libraryProjectId})
A structured component reference with optional library project ID.