newChildElement method

GedcomElement newChildElement({
  1. String? tag,
  2. String pointer = '',
  3. String value = '',
})

Creates and returns a new child element of this element

Implementation

GedcomElement newChildElement({
  String? tag,
  String pointer = '',
  String value = '',
}) {
  GedcomElement childElement;
  if (tag == GEDCOM_TAG_FAMILY) {
    childElement = FamilyElement(
      level: level + 1,
      pointer: pointer,
      value: value,
      crlf: crlf,
      parent: this,
    );
  } else if (tag == GEDCOM_TAG_FILE) {
    childElement = FileElement(
      level: level + 1,
      pointer: pointer,
      value: value,
      crlf: crlf,
      parent: this,
    );
  } else if (tag == GEDCOM_TAG_INDIVIDUAL) {
    childElement = IndividualElement(
      level: level + 1,
      pointer: pointer,
      value: value,
      crlf: crlf,
      parent: this,
    );
  } else if (tag == GEDCOM_TAG_OBJECT) {
    childElement = ObjectElement(
      level: level + 1,
      pointer: pointer,
      value: value,
      crlf: crlf,
      parent: this,
    );
  } else if (tag == GEDCOM_TAG_DATE) {
    childElement = DateElement(
      level: level + 1,
      pointer: pointer,
      value: value,
      crlf: crlf,
      parent: this,
    );
  } else if (tag == GEDCOM_TAG_BIRTH) {
    childElement = BirthElement(
      level: level + 1,
      pointer: pointer,
      value: value,
      crlf: crlf,
      parent: this,
    );
  } else if (tag == GEDCOM_TAG_DEATH) {
    childElement = DeathElement(
      level: level + 1,
      pointer: pointer,
      value: value,
      crlf: crlf,
      parent: this,
    );
  } else {
    childElement = GedcomElement(
      level: level + 1,
      pointer: pointer,
      tag: tag!,
      value: value,
      crlf: crlf,
      parent: this,
    );
  }
  children.add(childElement);
  return childElement;
}