add method

bool add(
  1. E value, {
  2. bool notify = true,
})

Add a value to this Relationship

Attempting to add an existing value has no effect as this is a Set

Implementation

bool add(E value, {bool notify = true}) {
  if (contains(value)) {
    return false;
  }

  // try to ensure value is initialized
  _ensureModelIsInitialized(value);

  if (value.isInitialized && isInitialized) {
    _graph._addEdge(_ownerKey, value._key!,
        metadata: _name, inverseMetadata: _inverseName);
  } else {
    // if it can't be initialized, add to the models queue
    _uninitializedModels.add(value);
  }
  return true;
}