vyuh_diagram_core 2.17.0
vyuh_diagram_core: ^2.17.0 copied to clipboard
Transactions, editor state, and history for Vyuh Diagram.
vyuh_diagram_core #
Create, connect and edit diagrams in pure Dart. Use the same controller in Flutter apps, servers and agents.
Install #
dart pub add vyuh_diagram_core
Create and connect #
import 'package:vyuh_diagram_core/vyuh_diagram_core.dart';
final controller = DiagramController();
final start = controller.createShape(
Shapes.rectangle, at: DiagramPoint.zero, text: 'Start',
);
final finish = controller.createShape(
Shapes.rectangle, at: const DiagramPoint(240, 0), text: 'Finish',
);
controller.connect(start, finish);
controller.undo();
controller.redo();
// Dispose the controller when its owner closes.
Direct calls return an ID or complete the edit; a denied edit throws.
Use controller.edits.createShape(...) when you want to inspect an
EditResult instead. Both use the same rules and undo history.
Core includes basic shapes, plain text, straight connectors, arrowheads,
freehand drawing, grid snapping, selection, grouping and undo/redo.
The grid is installed but hidden; enable it with
GridExtension(visible: true, snap: true) in your configuration.
Add another controller to controller.diagram for a person or agent working
on the same document. Install extensions once through DiagramConfiguration.
See Hello world, controller methods, configuration and agents.
License #
Licensed under the Apache License, Version 2.0. Third-party materials retain their own licenses and notices.