addExtension method
Registers an extension with this controller.
The extension's NodeFlowExtension.attach method is called immediately. Throws a StateError if an extension with the same ID is already registered.
Example:
controller.addExtension(UndoRedoExtension<MyData>());
Implementation
void addExtension(NodeFlowExtension<T> extension) {
if (_extensions.any((e) => e.id == extension.id)) {
throw StateError(
'Extension "${extension.id}" is already registered. '
'Remove it first before adding a new instance.',
);
}
_extensions.add(extension);
extension.attach(this);
}