makeUniqueKeyFunction property

dynamic Function(Model, Object)? get makeUniqueKeyFunction

Gets or sets a function that returns a unique id number or string for a node data object. This function is called by #makeNodeDataKeyUnique when a node data object is added to the model, either as part of a new #nodeDataArray or by a call to #addNodeData, to make sure the value of #getKeyForNodeData is unique within the model.

The value may be null in order to cause #makeNodeDataKeyUnique behave in the standard manner. (The default value is null.) You may want to supply a function here in order to make sure all of the automatically generated keys are in a particular format. Setting this property after setting #nodeDataArray has no real effect until there is a call to #addNodeData.

If you want to ensure that this function is called when copying data that already has a key, set #copiesKey to false. This is typically useful when copying a node from a Palette, where the key it has in the Palette's Model happens to be unique within the target Diagram's Model. Unless you set #copiesKey to false, the original key value will be copied and retained if it is already unique within the target model.

If a node data object is already in the model and you want to change its key value, call #setKeyForNodeData with a new and unique key.

Implementation

_i2.dynamic Function(
  _i3.Model,
  _i2.Object,
)? get makeUniqueKeyFunction => (
      _i3.Model p0,
      _i2.Object p1,
    ) =>
        _i4.callMethod(
          _i4.getProperty(
            this,
            'makeUniqueKeyFunction',
          ),
          r'call',
          [
            this,
            p0,
            p1,
          ],
        );
set makeUniqueKeyFunction (dynamic value(Model, Object)?)

Implementation

set makeUniqueKeyFunction(
    _i2.dynamic Function(
      _i3.Model,
      _i2.Object,
    )? value) {
  _i4.setProperty(
    this,
    'makeUniqueKeyFunction',
    value == null ? _i5.undefined : _i4.allowInterop(value),
  );
}