VSNodeManager constructor

VSNodeManager({
  1. required List nodeBuilders,
  2. String? serializedNodes,
  3. void onNodesUpdate(
    1. Map<String, VSNodeData> oldData,
    2. Map<String, VSNodeData> newData
    )?,
  4. dynamic onBuilderMissing(
    1. Map nodeJSON
    )?,
  5. List<VSNodeDataBuilder>? additionalNodes,
})

Holds all relevant node data

Handles interactions with the data

Creates an instance of VSNodeSerializationManager to handle serializations

Implementation

VSNodeManager({
  required List<dynamic> nodeBuilders,
  String? serializedNodes,
  this.onNodesUpdate,

  ///This function gets called when a node failed to deserialize due to a missing builder
  ///
  ///The nodeJSON in question is given as a parameter
  Function(Map nodeJSON)? onBuilderMissing,

  ///These nodes will not be part of [contextNodeBuilders]
  ///
  ///They will only be used for deserialization
  List<VSNodeDataBuilder>? additionalNodes,
}) {
  serializationManager = VSNodeSerializationManager(
    nodeBuilders: nodeBuilders,
    onBuilderMissing: onBuilderMissing,
    additionalNodes: additionalNodes,
  );

  if (serializedNodes != null) {
    _nodes = serializationManager.deserializeNodes(serializedNodes);
  }
}