canExecute method

bool canExecute(
  1. NodeFlowController<T> controller
)

Checks if this action can be executed in the current state.

Used to enable/disable menu items and prevent invalid operations. The default implementation returns true (always enabled).

Parameters:

  • controller: The node flow controller to check state against

Returns: true if the action can currently be executed

Example:

@override
bool canExecute(NodeFlowController<T> controller) {
  // Only allow if at least 2 nodes are selected
  return controller.selectedNodeIds.length >= 2;
}

Implementation

bool canExecute(NodeFlowController<T> controller) => true;