vyuh_diagram_types 3.5.0
vyuh_diagram_types: ^3.5.0 copied to clipboard
Immutable document model, shapes, text and geometry for Vyuh Diagram. Pure Dart with no Flutter dependency, so it runs on servers, CLIs and agents.
example/main.dart
import 'package:vyuh_diagram_types/vyuh_diagram_types.dart';
/// Builds an immutable diagram document and reads it back.
///
/// Documents are plain values and need no Flutter. To edit one, give it to a
/// `DiagramController` from `vyuh_diagram_core`.
void main() {
final document = DiagramDocument(
id: 'plan',
revision: 0,
elements: [
ShapeElement(
id: 'start',
type: Shapes.rectangle,
frame: const DiagramRect.fromLTWH(0, 0, 160, 80),
),
ShapeElement(
id: 'finish',
type: Shapes.rectangle,
frame: const DiagramRect.fromLTWH(240, 0, 160, 80),
),
],
);
final finish = document.elementById('finish') as ShapeElement;
// ignore: avoid_print
print('${document.elements.length} elements, finish at ${finish.frame}');
}