setChild method

  1. @override
bool setChild(
  1. String name,
  2. Object entities
)
override

Implementation

@override
bool setChild(String name, Object entities) {
  if (_concept == null) {
    throw new ConceptException('Entity concept is not defined.');
  }

  Child? child = _concept!.children.singleWhereCode(name) as Child?;
  if (child == null) {
    String msg =
        '${_concept!.code!}.$name is not correct child entities name.';
    throw UpdateException(msg);
  }

  if (child.update) {
    _childMap.update(name, (value) => entities);
    if (child.internal) {
      _internalChildMap[name] = entities;
    }
    return true;
  } else {
    return false;
    // String msg = '${_concept!.code!}.${child.code!} is not updatable.';
    // throw UpdateException(msg);
  }
}