vyuh_diagram_core 3.3.0 copy "vyuh_diagram_core: ^3.3.0" to clipboard
vyuh_diagram_core: ^3.3.0 copied to clipboard

Headless diagram engine for Dart: create shapes and connectors, edit through transactions with undo and redo, and extend with plugins. No Flutter needed.

Vyuh Diagram

vyuh_diagram_core on pub.dev pub points Apache-2.0

vyuh_diagram_core

A headless diagram engine for Dart: shapes, connectors, transactions and undo, with no Flutter required.

Vyuh Diagram · Docs · Examples · API reference

Create, connect and edit diagrams from plain Dart. The DiagramController applies every change as an undoable transaction, so the same code drives a Flutter app, a server, a command-line tool or an AI agent, and they all share one rules and history model.

What you get #

  • Content: basic shapes, plain text, straight connectors with arrowheads and freehand drawing.
  • Editing: selection, grouping, moving, styling and connecting, each as a single undo step; controller.edits.batch groups several into one.
  • Two ways to call: controller.createShape(...) returns an id and throws when an edit is denied; controller.edits.createShape(...) returns an EditResult to inspect instead. Both use the same rules and history.
  • Collaboration-ready: add another controller to controller.diagram for a person or agent working on the same document.
  • Extensible: install extensions once through DiagramConfiguration. The grid is installed but hidden; enable it with GridExtension(visible: true, snap: true).

Install #

dart pub add vyuh_diagram_core

For a Flutter app, add vyuh_diagram_flutter, which includes this package.

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.

Inspect a result #

final result = controller.edits.createShape(
  Shapes.rectangle, at: DiagramPoint.zero, text: 'Hello',
);
if (result.allowed) {
  print('Created ${result.id}');
} else {
  print('Denied: ${result.reason}');
}

A complete headless program, including batching, edits and saving, is in the package's example.

Learn more #

Where this fits #

Vyuh Diagram is a diagram editor you embed in your own app. Five packages are open source (Apache-2.0) on pub.dev:

Package What it is
vyuh_diagram_types Immutable document model and geometry.
vyuh_diagram_core Controller, edits and history, in pure Dart.
vyuh_diagram_flutter Flutter canvas, input and rendering.
vyuh_diagram_codec_json Save and load diagrams as JSON.
vyuh_diagram_codec_svg Export diagrams as SVG; import SVG shapes.

Commercial extensions add the editor, shape libraries, automatic layout, rich text, tables, a minimap and more. They come from pub.vyuh.tech; see package access and the full package list.

License #

Apache License, Version 2.0 (text). Third-party materials keep their own licenses; see the notices shipped in this package.

0
likes
0
points
456
downloads

Documentation

Documentation

Publisher

verified publishervyuh.tech

Weekly Downloads

Headless diagram engine for Dart: create shapes and connectors, edit through transactions with undo and redo, and extend with plugins. No Flutter needed.

Homepage

Topics

#diagram #flowchart #editor #undo-redo #headless

License

unknown (license)

Dependencies

characters, listen, mobx, vyuh_diagram_types

More

Packages that depend on vyuh_diagram_core