onEvent method

  1. @override
void onEvent(
  1. GraphEvent event
)
override

Called when a graph event occurs.

Use pattern matching to handle events of interest:

void onEvent(GraphEvent event) {
  switch (event) {
    case NodeAdded(:final node):
      // Handle node added
    case NodeMoved(:final node, :final previousPosition):
      // Handle node moved
    case BatchStarted(:final reason):
      // Start accumulating events
    case BatchEnded():
      // Finalize batch
    default:
      // Ignore other events
  }
}

Implementation

@override
void onEvent(GraphEvent event) {
  // Stats are reactive via direct observable access, no event handling needed
}