add method

EditResult add(
  1. DiagramElement element, {
  2. bool select = true,
})

Inserts an authored record exactly as supplied, through registry validation and the diagram's change hook. Does not infer registry creation defaults.

Implementation

EditResult add(DiagramElement element, {bool select = true}) =>
    store.edits.dispatch(
      DiagramTransaction(
        label: 'Add element',
        steps: [
          InsertElementsStep([element]),
        ],
        selectionAfter: select
            ? ElementSelection({element.id})
            : store.state.selection,
      ),
    );