Controller reference
Everything a DiagramController offers, grouped by purpose: its members, the verbs of every Vyuh Diagram extension, and the view and effects of a mounted canvas. See diagram and controller for how they fit together and verbs for performing, checking and writing verbs.
A verb is a named, undoable edit. Every verb can be performed by name with controller.perform(ids, name, args), and most have a typed Dart method of the same name. Each verb entry gives its name, what it targets and its arguments; ? marks an optional one. Members without a verb do not change the document. Under each member is the package that provides it, and the library to import when it is not the package's main library. This page is generated from the API and the installed verb registry.
Use direct methods for everyday edits: creation returns the new ID, and refused edits throw DiagramChangeDenied. Use the same method names through controller.edits when you need an EditResult to inspect allowed, id, code and reason. Both paths share the document and undo history.
| Group | What it covers |
|---|---|
| Construct and open | Create a controller with a new diagram, join an existing one, or open saved data. |
| Document and state | Read what this actor sees, including its own in-progress preview. |
| Verbs and discovery | Perform any verb by name, check it first, and discover what a target accepts. |
| Create and delete | Add elements with registry defaults, remove them, and copy them. |
| Select | Change this actor's selection. Selection is not part of the document or history. |
| Arrange and transform | Move, size, rotate and order elements. |
| Structure | Group, frame and reparent elements. |
| Style and shape | Appearance, visibility, locking, values and type of elements. |
| Text | Plain text, paragraph settings and a shape's text parts. |
| Rich text | Formatting of rich text stories, over the whole story or a range. |
| Connections and ports | Connect elements, route and style connectors, label them, and set ports. |
| Paths | Edit the nodes and handles of an editable path. |
| Tables | Rows, columns, cells and borders of table content. Shapes with several tables qualify these verbs by part, such as primary.insertRow. |
| Layout | Arrange root-level nodes automatically with an installed layout algorithm. |
| History and interactions | Undo this actor's own edits, group verbs into one step, and preview continuous edits. |
| Persistence and output | Save and load documents, and export images. |
| Canvas and view | The camera, tools, and the viewport of the mounted canvas. |
| Effects | Transient effects on the mounted canvas. They never change the document or history. |
| Configuration and options | The diagram's shared configuration, applied to every controller on it. |
| Participants | The shared diagram and the actor this controller edits as. |
| Extension authoring | Engine hooks for verb implementations, from the adapter library. |
| Lifecycle | Mounting and disposal. |
Construct and open
Create a controller with a new diagram, join an existing one, or open saved data.
| Member | What it does |
|---|---|
DiagramController({DiagramConfiguration? configuration, DiagramDocument? document, Diagram? diagram, DiagramParticipant participant = DiagramParticipant.local})vyuh_diagram_core | A controller of a new diagram of document, configured by configuration. |
static DiagramController open<T>(T data, {required DiagramDocumentCodec<T> Function(DiagramModelCodecs) format, DiagramConfiguration configuration = const DiagramConfiguration(), DiagramParticipant participant = DiagramParticipant.local})vyuh_diagram_core | A controller of a new diagram opened from data saved in format, such as DiagramJsonCodec.new, decoded over the configured extensions' codecs. |
Document and state
Read what this actor sees, including its own in-progress preview.
| Member | What it does |
|---|---|
DiagramDocument documentvyuh_diagram_core | The document this actor sees, including its own in-progress preview. |
ResolvedScene scenevyuh_diagram_core | The resolved geometry of document. |
DiagramElement? elementById(String id)vyuh_diagram_core | The element id as this actor sees it. |
ResolvedElement? resolvedElementById(String id)vyuh_diagram_core | Live geometry of one identity, observed independently of the whole scene. |
Verbs and discovery
Perform any verb by name, check it first, and discover what a target accepts.
| Member | What it does |
|---|---|
DiagramEdits editsvyuh_diagram_core | The shared diagram this controller edits. |
void perform(Iterable<String> ids, String verb, [Map<String, Object?> args = const {}])vyuh_diagram_core | Performs the edit; throws when denied. |
EditResult canPerform(Iterable<String> ids, String verb, [Map<String, Object?> args = const {}])vyuh_diagram_core | Whether perform would run verb on ids with args, and why not. |
List<DiagramVerbDescription> verbs([Iterable<String> ids = const []])vyuh_diagram_core | The verbs available on ids, with their schemas and whether each can run now. |
DiagramVerbDescription? verb(Iterable<String> ids, String name)vyuh_diagram_core | The verb name on ids with its schema and availability, or null when no such verb applies to them. |
DiagramElementAnatomy? describe(String id)vyuh_diagram_core | What element id is made of: its text slots, value schema, ports, structured content and whether it owns children. |
DiagramPropertyFields properties({Iterable<String>? ids})vyuh_diagram_core | The inspector's properties of element id, with current values. |
void setProperty(Iterable<String> ids, String key, Object? value)vyuh_diagram_core | Performs the edit; throws when denied. |
DiagramDiagnostics checkDiagnostics({Iterable<Iterable<DiagramDiagnostic> Function(DiagramDocument)> rules = const []})vyuh_diagram_core | Checks the installed domain rules against one document snapshot. |
void fixDiagnostic(DiagramDiagnostics report, DiagramDiagnosticFix fix)vyuh_diagram_core | Performs the edit; throws when denied. |
DiagramElement? applyTo(DiagramElement element, String verb, [Map<String, Object?> arguments = const {}])vyuh_diagram_core | What setter verb with args would make of element, an element outside the document such as the next shape a creation tool makes. |
Create and delete
Add elements with registry defaults, remove them, and copy them.
| Member | What it does |
|---|---|
String createShape(String type, {required DiagramPoint at, String? id, DiagramSize? size, ShapeStyle? style, Map<String, Object?>? values, String? text, TextStory? textStory, DiagramTextSizingMode? textSizingMode, List<Port>? ports, DiagramShapeParentPlacement? parent, bool select = true, int zIndex = 0})vyuh_diagram_core | Creates and returns the identity; throws when denied. Verb createShape on the diagram: type: text, at: point, id?: text, size?: size, style?: style, values?: values, text?: text, textStory?: story, textSizingMode?: choice, ports?: ports, parent?: parent, select?: boolean, zIndex?: integer |
String createText({String type = Shapes.text, required DiagramPoint at, String? id, DiagramSize? size, String? text, TextStory? textStory, DiagramTextSizingMode? textSizingMode, DiagramShapeParentPlacement? parent, bool select = true, int zIndex = 0})vyuh_diagram_core | Creates and returns the identity; throws when denied. Verb createText on the diagram: at: point, type?: text, id?: text, size?: size, text?: text, textStory?: story, textSizingMode?: choice, parent?: parent, select?: boolean, zIndex?: integer |
String createPath({required DiagramVectorPath path, required DiagramPoint at, DiagramSize? size, ShapeStyle? style, String? id, DiagramShapeParentPlacement? parent, bool select = true})vyuh_diagram_core | Creates and returns the identity; throws when denied. |
String createLine({required DiagramPoint start, required DiagramPoint end, ShapeStyle? style, String? id, DiagramShapeParentPlacement? parent, bool select = true})vyuh_diagram_core | Creates and returns the identity; throws when denied. |
String createPolyline({required Iterable<DiagramPoint> points, bool closed = false, ShapeStyle? style, String? id, DiagramShapeParentPlacement? parent, bool select = true})vyuh_diagram_core | Creates and returns the identity; throws when denied. |
String createConnected({required ConnectorEndpoint source, required FramedElement element, String? toPort, String? connectorId, String connectorType = 'connector', ConnectorRoute route = ConnectorRoute.straight, int connectorZIndex = -1, bool select = true})vyuh_diagram_core | Creates and returns the identity; throws when denied. Verb createConnected on the diagram: source: endpoint, element: element, toPort?: text, connectorId?: text, connectorType?: text, route?: route, connectorZIndex?: integer, select?: boolean |
String createConnectedShape(String type, {required BoundEndpoint source, required DiagramPoint at, String? toPort, ConnectorRoute route = ConnectorRoute.straight, int? expectedRevision})vyuh_diagram_core | Creates and returns the identity; throws when denied. Verb createConnectedShape on the diagram: type: text, source: endpoint, at: point, toPort?: text, route?: route |
void add(DiagramElement element, {bool select = true})vyuh_diagram_core | Performs the edit; throws when denied. Verb add on the diagram: element: element, select?: boolean |
String allocateId(String prefix)vyuh_diagram_core | A fresh element identity with prefix, unused in the document. |
void delete({Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb delete on elements |
DiagramClipboardPayload copy({Iterable<String>? ids})vyuh_diagram_core | Captures ids, or the selection, for paste. |
void paste(DiagramClipboardPayload payload, {DiagramPoint offset = const DiagramPoint(24, 24)})vyuh_diagram_core | Performs the edit; throws when denied. Verb paste on the diagram: payload: clipboard, offset?: point |
void duplicate({Iterable<String>? ids, DiagramPoint offset = const DiagramPoint(24, 24)})vyuh_diagram_core | Performs the edit; throws when denied. Verb duplicate on elements: offset?: point |
Select
Change this actor's selection. Selection is not part of the document or history.
| Member | What it does |
|---|---|
DiagramSelection selectionvyuh_diagram_core | This actor's selection. |
void select(Iterable<String> ids)vyuh_diagram_core | Selects ids, replacing the current selection. |
void selectAll({String? ownerId})vyuh_diagram_core | Selects every element owned by ownerId, or every element. |
void clearSelection()vyuh_diagram_core | Clears this actor's selection. |
void setSelection(DiagramSelection selection)vyuh_diagram_core | Replaces this actor's selection. |
Arrange and transform
Move, size, rotate and order elements.
| Member | What it does |
|---|---|
void move(DiagramPoint delta, {Iterable<String>? ids, Motion? motion})vyuh_diagram_core | Performs the edit; throws when denied. Verb move on elements: delta: point, motion?: motion |
void resize(DiagramSize size, {Iterable<String>? ids, bool fromCenter = false, bool preserveAspectRatio = false, Motion? motion})vyuh_diagram_core | Performs the edit; throws when denied. Verb resize on elements: size: size, fromCenter?: boolean, preserveAspectRatio?: boolean, motion?: motion |
void rotate({Iterable<String>? ids, required DiagramPoint pivot, required double radians})vyuh_diagram_core | Performs the edit; throws when denied. Verb rotate on elements: pivot: point, radians: number |
void setElementBounds(String id, DiagramRect bounds, {Motion? motion})vyuh_diagram_core | Performs the edit; throws when denied. Verb setElementBounds on one element: bounds: rect, motion?: motion |
void align(DiagramAlignment alignment, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb align on elements: alignment: choice |
void distribute(DiagramDistribution distribution, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb distribute on elements: distribution: choice |
void reorder(DiagramLayerOrder order, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb reorder on elements: order: choice |
void setZIndex(int zIndex, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb setZIndex on elements: zIndex: integer |
void arrangeLanes({Iterable<String>? ids, DiagramLaneDirection direction = DiagramLaneDirection.rows, DiagramSize? laneSize, double gap = 0})vyuh_diagram_core | Performs the edit; throws when denied. Verb arrangeLanes on elements: direction?: choice, laneSize?: size, gap?: number |
Structure
Group, frame and reparent elements.
| Member | What it does |
|---|---|
void group({Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb group on elements |
void ungroup({Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb ungroup on elements |
void frame({Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb frame on elements |
void unframe({Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb unframe on elements |
void reparent({Iterable<String>? ids, String? parentId, DiagramPoint delta = DiagramPoint.zero})vyuh_diagram_core | Performs the edit; throws when denied. Verb reparent on elements: parent?: text, delta?: point |
void setFrameCollapsed(String id, bool collapsed)vyuh_diagram_core | Performs the edit; throws when denied. Verb setFrameCollapsed on one element: collapsed: boolean |
Style and shape
Appearance, visibility, locking, values and type of elements.
| Member | What it does |
|---|---|
void setStyle({Iterable<String>? ids, DiagramFill? fill, DiagramColor? stroke, double? strokeWidth, double? cornerRadius, StrokeStyle? strokeStyle, InkPreset? inkPreset})vyuh_diagram_core | Performs the edit; throws when denied. Verb setStyle on elements: fill?: fill, stroke?: color, strokeWidth?: number, cornerRadius?: number, strokeStyle?: choice, inkPreset?: choice |
void setOpacity(double opacity, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb setOpacity on elements: opacity: number |
void setVisible(bool visible, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb setVisible on elements: visible: boolean |
void setLocked(bool locked, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb setLocked on elements: locked: boolean |
void setAspectLocked(bool locked, {Iterable<String>? ids, bool square = false})vyuh_diagram_core | Performs the edit; throws when denied. Verb setAspectLocked on elements: locked: boolean, square?: boolean |
void setPolygonSides(int sides, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb setPolygonSides on elements: sides: integer |
void setClipContent(bool clip, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb setClipContent on elements: clip: boolean |
void setImage(String id, DiagramImageSource? image)vyuh_diagram_core | Performs the edit; throws when denied. Verb setImage on one element: image?: image |
void setValues(String id, Map<String, Object?> values)vyuh_diagram_core | Performs the edit; throws when denied. Verb setValues on elements: values: values |
void setType(String id, String type)vyuh_diagram_core | Performs the edit; throws when denied. Verb setType on one element: type: text |
ShapeStyle shapeCreationStyle(String type)vyuh_diagram_core | Appearance for subsequent creations of this registered shape type. |
void setShapeCreationStyle(String type, ShapeStyle style)vyuh_diagram_core | Sets the appearance of future shapes of type. |
void showSecondarySection(String id, bool shown)vyuh_diagram_extension_shapes | Shows or hides the secondary section of entity id.Verb showSecondarySection on one element: shown: boolean |
Text
Plain text, paragraph settings and a shape's text parts.
| Member | What it does |
|---|---|
void setText(String id, String text, {String? slot, String? storyId})vyuh_diagram_core | Performs the edit; throws when denied. Verb setText on one element: text: text, storyId?: text |
void setTextAlignment(String id, ParagraphAlignment alignment, {String? storyId, int start = 0, int? end})vyuh_diagram_core | Performs the edit; throws when denied. Verb setTextAlignment on one element: alignment: choice, storyId?: text, start?: integer, end?: integer |
void setTextDirection(String id, ParagraphDirection direction, {String? storyId, int start = 0, int? end})vyuh_diagram_core | Performs the edit; throws when denied. Verb setTextDirection on one element: direction: choice, storyId?: text, start?: integer, end?: integer |
perform(ids, 'replaceText', {…})vyuh_diagram_core | Replaces story before with after, which keeps its identity. Editors and formatting build on it. Verb replaceText on one element: before: story, after: story, label?: text, selectionAfter?: selection |
perform(ids, 'setTextStory', {…})vyuh_diagram_core | Sets a shape's whole text story, such as the one its definition starts text with, or removes it. Verb setTextStory on one element: story?: story |
void addSlot(String id, String slot, {String? text})vyuh_diagram_core | Performs the edit; throws when denied. Verb addSlot on one element: slot: text, text?: text |
void removeSlot(String id, String slot)vyuh_diagram_core | Performs the edit; throws when denied. Verb removeSlot on one element: slot: text |
void setTitle(String id, String title)vyuh_diagram_core | Sets the title of card id.Verb setTitle on one element: title: text |
void setDescription(String id, String description)vyuh_diagram_core | Sets the description of card id.Verb setDescription on one element: description: text |
void setTag(String id, String? tag)vyuh_diagram_core | Shows the tag of card id with tag, or hides it when tag is null.Verb setTag on one element: tag?: text |
Rich text
Formatting of rich text stories, over the whole story or a range.
| Member | What it does |
|---|---|
String createRichText({required DiagramPoint at, String? id, DiagramSize? size, String? text, TextStory? textStory, DiagramTextSizingMode? textSizingMode, DiagramShapeParentPlacement? parent, bool select = true, int zIndex = 0})vyuh_diagram_extension_rich_text | Creates rich text and returns its ID. |
void setMark({required String elementId, required TextMark mark, required bool on, String? storyId, int start = 0, int? end})vyuh_diagram_extension_rich_text | Turns mark, such as bold, on or off over the story or a range.Verb setMark on one element: mark: choice, on: boolean, storyId?: text, start?: integer, end?: integer |
void setHeading({required String elementId, required HeadingLevel heading, String? storyId, int start = 0, int? end})vyuh_diagram_extension_rich_text | Makes the touched paragraphs headings at heading, or body text.Verb setHeading on one element: heading: choice, storyId?: text, start?: integer, end?: integer |
void setList({required String elementId, required ParagraphKind kind, String? storyId, int start = 0, int? end})vyuh_diagram_extension_rich_text | Makes the touched paragraphs list items of kind, or ordinary paragraphs with ParagraphKind.paragraph.Verb setList on one element: kind: choice, storyId?: text, start?: integer, end?: integer |
void changeIndent({required String elementId, required int delta, String? storyId, int start = 0, int? end})vyuh_diagram_extension_rich_text | Indents the touched paragraphs by delta levels, or outdents them.Verb changeIndent on one element: delta: integer, storyId?: text, start?: integer, end?: integer |
void adjustFontSize({required String elementId, required double delta, String? storyId, int start = 0, int? end})vyuh_diagram_extension_rich_text | Steps font sizes by delta within the target's font size range.Verb adjustFontSize on one element: delta: number, storyId?: text, start?: integer, end?: integer |
void clearFormatting({required String elementId, String? storyId, int start = 0, int? end})vyuh_diagram_extension_rich_text | Removes marks and paragraph formatting from the story or a range. Verb clearFormatting on one element: storyId?: text, start?: integer, end?: integer |
void setChecked({required String elementId, required String blockId, required bool checked, String? storyId})vyuh_diagram_extension_rich_text | Checks or unchecks checklist item blockId.Verb setChecked on one element: block: text, checked: boolean, storyId?: text |
Connections and ports
Connect elements, route and style connectors, label them, and set ports.
| Member | What it does |
|---|---|
String connect(String from, String to, {String? fromPort, String? toPort, String type = 'connector', ConnectorRoute route = ConnectorRoute.straight, bool select = true})vyuh_diagram_core | Creates and returns the identity; throws when denied. Verb connect on the diagram: from: text, to: text, fromPort?: text, toPort?: text, type?: text, route?: route, select?: boolean |
void reconnect(String connectorId, {required bool atStart, required ConnectorEndpoint endpoint})vyuh_diagram_core | Performs the edit; throws when denied. Verb reconnect on one element: atStart: boolean, endpoint: endpoint |
void setConnectorStyle(String connectorId, {DiagramColor? color, double? strokeWidth, StrokeStyle? strokeStyle})vyuh_diagram_core | Performs the edit; throws when denied. Verb setConnectorStyle on elements: color?: color, strokeWidth?: number, strokeStyle?: choice |
void setStartArrowhead(String connectorId, {ArrowheadKind? kind, double? width, double? height})vyuh_diagram_core | Performs the edit; throws when denied. Verb setStartArrowhead on elements: kind?: arrowhead, width?: number, height?: number |
void setEndArrowhead(String connectorId, {ArrowheadKind? kind, double? width, double? height})vyuh_diagram_core | Performs the edit; throws when denied. Verb setEndArrowhead on elements: kind?: arrowhead, width?: number, height?: number |
void setConnectorRoute(String connectorId, {ConnectorRoute? route, double? portSpacing, Map<String, Object?> options = const {}})vyuh_diagram_core | Performs the edit; throws when denied. Verb setConnectorRoute on elements: route?: route, portSpacing?: number, options?: values |
void setRouteGeometry(String connectorId, {ConnectorRoute? route, double? bend, List<DiagramPoint>? controlPoints, List<DiagramPoint>? routedPoints, bool? preserveRoute})vyuh_diagram_core | Performs the edit; throws when denied. Verb setRouteGeometry on one element: route?: route, bend?: number, controlPoints?: points, routedPoints?: points, preserveRoute?: boolean |
void reroute({Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb reroute on the diagram: connectors?: ids |
String addConnectorLabel(String connectorId, {TextStory? story, String? text, double? fraction, DiagramPoint offset = DiagramPoint.zero, DiagramSize? size})vyuh_diagram_core | Creates and returns the identity; throws when denied. Verb addConnectorLabel on one element: text?: text, story?: story, fraction?: number, offset?: point, size?: size |
void setConnectorLabel(String connectorId, String labelId, {TextStory? story, double? fraction, DiagramPoint? offset, DiagramSize? size, LabelPresentation? presentation})vyuh_diagram_core | Performs the edit; throws when denied. Verb setConnectorLabel on one element: label: text, story?: story, fraction?: number, offset?: point, size?: size, presentation?: labelPresentation |
void removeConnectorLabel(String connectorId, String labelId)vyuh_diagram_core | Performs the edit; throws when denied. Verb removeConnectorLabel on one element: label: text |
void arrangeLabels({Iterable<String>? ids, double spacing = 8})vyuh_diagram_core | Performs the edit; throws when denied. Verb arrangeLabels on the diagram: connectors?: ids, spacing?: number |
void setConnectorCreationRoute(ConnectorRoute route)vyuh_diagram_core | The route kind new connectors use. |
void setPorts(List<Port> ports, {Iterable<String>? ids})vyuh_diagram_core | Performs the edit; throws when denied. Verb setPorts on elements: ports: ports |
Paths
Edit the nodes and handles of an editable path.
| Member | What it does |
|---|---|
void setPathClosed(String elementId, bool closed)vyuh_diagram_core | Performs the edit; throws when denied. Verb setPathClosed on one element: closed: boolean |
void setPathHandleMode(String elementId, String nodeId, DiagramPathHandleMode mode)vyuh_diagram_core | Performs the edit; throws when denied. Verb setPathHandleMode on one element: node: text, mode: choice |
void setPathSegmentKind(String elementId, String nodeId, DiagramPathSegmentKind kind)vyuh_diagram_core | Performs the edit; throws when denied. Verb setPathSegmentKind on one element: node: text, kind: choice |
String addPathPoint(String elementId, {required String after, double t = .5, String? id})vyuh_diagram_core | Creates and returns the identity; throws when denied. Verb addPathPoint on one element: after: text, t?: number, id?: text |
void removePathNodes(String elementId, Set<String> nodeIds)vyuh_diagram_core | Performs the edit; throws when denied. Verb removePathNodes on one element: nodes: ids |
void movePathControl(String elementId, String nodeId, DiagramPathControl control, DiagramPoint position)vyuh_diagram_core | Performs the edit; throws when denied. Verb movePathControl on one element: node: text, control: choice, position: point |
Tables
Rows, columns, cells and borders of table content. Shapes with several tables qualify these verbs by part, such as primary.insertRow.
| Member | What it does |
|---|---|
void insertRow(String id, {required int at, int? focusColumn, String? part})vyuh_diagram_extension_table | Inserts a row at index at of the table in shape id.Verb insertRow on one element: at: integer, focusColumn?: integer |
void removeRow(String id, {required int at, String? part})vyuh_diagram_extension_table | Removes the row at index at of the table in shape id.Verb removeRow on one element: at: integer |
void insertColumn(String id, {required int at, String? part})vyuh_diagram_extension_table | Inserts a column at index at of the table in shape id.Verb insertColumn on one element: at: integer |
void removeColumn(String id, {required int at, String? part})vyuh_diagram_extension_table | Removes the column at index at of the table in shape id.Verb removeColumn on one element: at: integer |
void removeTracks(String id, {required String anchor, required String focus, required bool rows, String? part})vyuh_diagram_extension_table | Removes the rows, or the columns, a cell range spans. Verb removeTracks on one element: anchor: text, focus: text, rows: boolean |
void resizeRow(String id, {required int index, required double height, String? part})vyuh_diagram_extension_table | Sets the height of row index.Verb resizeRow on one element: index: integer, size: number |
void resizeColumn(String id, {required int index, required double width, String? part})vyuh_diagram_extension_table | Sets the width of column index.Verb resizeColumn on one element: index: integer, size: number |
void mergeCells(String id, {required String anchor, required String focus, String? part})vyuh_diagram_extension_table | Merges the cells from anchor to focus into one cell.Verb mergeCells on one element: anchor: text, focus: text |
void splitCell(String id, {required String cell, String? part})vyuh_diagram_extension_table | Splits the merged cell containing cell back into its cells.Verb splitCell on one element: cell: text |
void setCellText(String id, {required String cell, required String text, String? part})vyuh_diagram_extension_table | Replaces the text of cell with text, one plain paragraph per line.Verb setCellText on one element: cell: text, text: text |
void clearCells(String id, {required String anchor, required String focus, String? part})vyuh_diagram_extension_table | Empties the text of the cells from anchor to focus.Verb clearCells on one element: anchor: text, focus: text |
void setBorders(String id, {DiagramBorder? outer, DiagramBorder? rows, DiagramBorder? columns, String? part})vyuh_diagram_extension_table | Sets the table's outer, rows and columns borders.Verb setBorders on one element: outer?: border, rows?: border, columns?: border |
void setRowBorder(String id, {required int index, DiagramBorder? border, String? part})vyuh_diagram_extension_table | Sets the border after row index, or clears it when border is null so the table's row border applies.Verb setRowBorder on one element: index: integer, border?: border |
void setColumnBorder(String id, {required int index, DiagramBorder? border, String? part})vyuh_diagram_extension_table | Sets the border after column index, or clears it when border is null so the table's column border applies.Verb setColumnBorder on one element: index: integer, border?: border |
void selectTableCells(String elementId, String tableId, String anchorCellId, String focusCellId)vyuh_diagram_extension_table/extension_api.dart | Selects the cells from anchorCellId to focusCellId of table tableId. |
void focusTableCell(String elementId, String tableId, String cellId)vyuh_diagram_extension_table/extension_api.dart | Selects the text of cell cellId, or of the merged cell containing it. |
bool navigateTableCell(String elementId, String cellId, {bool backward = false})vyuh_diagram_extension_table/extension_api.dart | Row-major cell navigation; forward navigation at the end appends one row. |
bool enterTableCell(String elementId, String cellId)vyuh_diagram_extension_table/extension_api.dart | Enter inserts below the active cell, preserving its column and editing focus. |
ResolvedTable? resolvedTable(String elementId, String tableId)vyuh_diagram_extension_table/extension_api.dart | The laid-out table tableId of element elementId, or null. |
ShapeTableControls tableControls(String elementId, String tableId)vyuh_diagram_extension_table/extension_api.dart | The table edits the shape's definition permits for table tableId. |
DiagramToolGesture tableResizeGesture(String elementId, String tableId, {required bool row, required int index, required DiagramPoint pointerOrigin})vyuh_diagram_extension_table/extension_api.dart | A gesture that resizes row or column index as the pointer moves from pointerOrigin. |
Layout
Arrange root-level nodes automatically with an installed layout algorithm.
| Member | What it does |
|---|---|
Future<void> layout(Layout layout, {Iterable<String>? nodeIds, String? ownerId, Motion? motion})vyuh_diagram_core | Performs the edit; throws when denied. |
void cancelLayout()vyuh_diagram_core | Cancels a pending layout: its computation may finish, but its result is not applied. |
perform(ids, 'applyLayout', {…})vyuh_diagram_core | Places sibling nodes at the given frames, as a graph layout computed them. Verb applyLayout on the diagram: frames: frames, label?: text, motion?: motion |
History and interactions
Undo this actor's own edits, group verbs into one step, and preview continuous edits.
| Member | What it does |
|---|---|
void undo()vyuh_diagram_core | Performs the edit; throws when denied. |
void redo()vyuh_diagram_core | Performs the edit; throws when denied. |
bool canUndovyuh_diagram_core | Whether this controller has an edit of its own to undo. |
bool canRedovyuh_diagram_core | Whether this controller has an undone edit to redo. |
void batch(String label, void Function() build, {bool history = true})vyuh_diagram_core | Performs the edit; throws when denied. |
DiagramInteractionLease beginInteraction(String label, {bool cumulative = false})vyuh_diagram_core | Starts a continuous edit, such as a drag: each preview replaces the last, DiagramInteractionLease.commit records one undo entry and DiagramInteractionLease.cancel restores the start. |
void cancelInteraction()vyuh_diagram_core | Cancels this controller's active interaction, restoring its start without a history entry. |
bool isInteractingvyuh_diagram_core | Whether this controller holds an interaction, such as a drag. |
Persistence and output
Save and load documents, and export images.
| Member | What it does |
|---|---|
T save<T>(DiagramDocumentCodec<T> Function(DiagramModelCodecs) format)vyuh_diagram_core | The current document encoded in format, such as DiagramJsonCodec.new, over the installed extensions' codecs so the content and text they own persist. |
void load<T>(T data, {DiagramDocumentCodec<T> Function(DiagramModelCodecs)? format, int? expectedRevision, String label = 'Import diagram'})vyuh_diagram_core | Performs the edit; throws when denied. Verb load on the diagram: document: document, label?: text |
Future<SvgSnapshot> exportSvg(SvgOptions options, {Object Function(DiagramImageSource)? imageProvider})vyuh_diagram_core | Exports the committed snapshot as SVG, through the installed or mounted output. |
Future<PngSnapshot> exportPng(PngOptions options, {Object Function(DiagramImageSource)? imageProvider})vyuh_diagram_core | Exports the committed snapshot as PNG, through the installed or mounted output. |
Canvas and view
The camera, tools, and the viewport of the mounted canvas.
| Member | What it does |
|---|---|
DiagramCameraState cameravyuh_diagram_core | This actor's viewport. |
void setCamera(DiagramCameraState camera)vyuh_diagram_core | Moves this actor's viewport. |
DiagramPoint screenToWorld(DiagramPoint point)vyuh_diagram_core | The world point under a screen point of the mounted canvas. |
DiagramPoint globalToWorld(Offset globalPosition)vyuh_diagram_flutter | The world point under a global screen position of the mounted canvas. |
DiagramTool activeToolvyuh_diagram_core | The tool this actor has active. |
DiagramToolRegistry toolsvyuh_diagram_core | The tools this controller can activate. |
void setTool(DiagramTool tool)vyuh_diagram_core | Activates tool, one of DiagramController.tools. |
DiagramView viewvyuh_diagram_flutter | Moves the viewport of the mounted canvas. |
Future<bool> view.show(ViewTarget target, {Motion? motion})vyuh_diagram_flutter | Shows target, jumping when motion is null. |
void view.stop()vyuh_diagram_flutter | Interrupts the current move, if any. |
TextRun? view.typingStylevyuh_diagram_flutter | The style new typing takes at the caret of the canvas's text editor, or null when no text is being edited. |
bool view.formatTextSelection(String label, TextRun Function(TextRun) format)vyuh_diagram_flutter | Applies format to the edited text's selected range, or to future typing at a caret. |
Effects
Transient effects on the mounted canvas. They never change the document or history.
| Member | What it does |
|---|---|
DiagramEffects effectsvyuh_diagram_flutter | Plays transient effects on the mounted canvas. |
EffectHandle effects.play(Effect effect, {required String on})vyuh_diagram_flutter | Plays effect on the element with id on and returns its handle. |
void effects.stopAll({String? on})vyuh_diagram_flutter | Stops every effect, or only those playing on the element with id on. |
List<EffectHandle> effects.playingvyuh_diagram_flutter | Every playing effect. |
List<EffectHandle> effects.playingOn(String id)vyuh_diagram_flutter | The effects playing on the element with id. |
EffectRegistry effects.registryvyuh_diagram_flutter | The effects this canvas can play. |
Configuration and options
The diagram's shared configuration, applied to every controller on it.
| Member | What it does |
|---|---|
DiagramConfiguration configurationvyuh_diagram_core | The diagram's configuration, with its current bounds, fonts, default font family and rules. |
CanvasBounds boundsvyuh_diagram_core | How far the canvas extends. |
void setBounds(CanvasBounds bounds)vyuh_diagram_core | Performs the edit; throws when denied. |
void setFonts(DiagramFontChoices fonts)vyuh_diagram_core | Performs the edit; throws when denied. |
void setDefaultFontFamily(String? family)vyuh_diagram_core | Performs the edit; throws when denied. |
T options<T extends Object>()vyuh_diagram_core | The current options of type T, owned by one installed extension, such as GridOptions. |
void setOptions(Object value)vyuh_diagram_core | Performs the edit; throws when denied. |
Participants
The shared diagram and the actor this controller edits as.
| Member | What it does |
|---|---|
Diagram diagramvyuh_diagram_core | The shared diagram this controller edits. |
DiagramParticipant participantvyuh_diagram_core | The actor this controller edits as; history and locks refer to its id. |
Extension authoring
Engine hooks for verb implementations, from the adapter library.
| Member | What it does |
|---|---|
void dispatch(DiagramTransaction transaction, {int? expectedRevision})vyuh_diagram_core | Performs the edit; throws when denied. |
DiagramControllerInternals internalsvyuh_diagram_core/adapter.dart | Engine access for platform adapters, such as the mounted canvas. |
DiagramEditorState statevyuh_diagram_core/adapter.dart | What this actor sees, including its own in-progress preview. |
Lifecycle
Mounting and disposal.
| Member | What it does |
|---|---|
bool isAttachedvyuh_diagram_core | Whether a canvas is mounted for this controller. |
bool isDisposedvyuh_diagram_core | Whether this controller, or its diagram, is disposed. |
void dispose()vyuh_diagram_core | Ends this controller. |