DiagramEditorContext.withSharedModel constructor

DiagramEditorContext.withSharedModel(
  1. DiagramEditorContext oldContext, {
  2. required PolicySet policySet,
})

Allows you to create DiagramEditorContext with shared model from another DiagramEditorContext.

Warning: LinkAttachmentPolicy is used in CanvasModel, so this policy will be shared as well, even if you put new one to PolicySet.

Implementation

DiagramEditorContext.withSharedModel(
  DiagramEditorContext oldContext, {
  required this.policySet,
})  : _canvasModel = oldContext.canvasModel,
      _canvasState = CanvasState() {
  policySet.initializePolicy(_getReader(), _getWriter());
}