gedcom_structures 0.0.2 copy "gedcom_structures: ^0.0.2" to clipboard
gedcom_structures: ^0.0.2 copied to clipboard

Utility Dart library for GEDCOM tags and GEDCOM structures Dart Classes.

GEDCOM Structures #

Dart Classes for GEDCOM structures (generated from GEDCOM 7 machine-readable specification).
Based on gedcom_codec.

Usage #

import 'package:gedcom_codec/gedcom_codec.dart';
import 'package:gedcom_structures/gedcom_7.dart';

void main() {
  final document = GedcomCodec().decode(gedcomString)
              .toGedcom7Document();
  //          ^^^^^^^^^^^^^^^^^
  //         converts [GedcomDocument] to [Gedcom7Document].

  final families = document.getAll<FamilyRecordStructure>();
  //                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  //         allows searching by Dart Type,
  //
  //         e.g. [FamilyRecordStructure] is extending
  //              sealed [Gedcom7Structure], which is also
  //              allows for a proper pattern matching.

  for (final family in families) {
    print(
      'Family ${family.xref}:'
      '\n  husband:${family.husb?.xref}'
      //                    ^^^^
      //     generated structures have getters for corresponding
      //     nested structures as defined in the specification.
      '\n  wife:${family.wife?.xref}'
      '\n  children:${family.chilList.toList()}',
    );
  }

  final individuals = document.getAll<IndividualStructure>();
  for (final individual in individuals) {
    print(
      'Individual ${individual.xref}:'
      '\n  sex: ${individual.sex?.valueText}'
      //                          ^^^^^^^^^
      //     [GedcomStructureValueExtension] on [GedcomStructure] allows
      //     to parse the `payload` as a corresponding type.
      '\n  name: ${individual.nameList.firstOrNull?.valueText}',
    );
  }
}

Additional information #

Links:

GEDCOM files sources:

NOTICE:
This work comprises, is based on, or is derived from the FAMILYSEARCH GEDCOM™
Specification, © 1984-2025 Intellectual Reserve, Inc. All rights reserved.
“FAMILYSEARCH GEDCOM™” and “FAMILYSEARCH®” are trademarks of Intellectual
Reserve, Inc. and may not be used except as allowed by the Apache 2.0 license that governs this
work or as expressly authorized in writing and in advance by Intellectual Reserve, Inc.
1
likes
150
points
29
downloads

Publisher

verified publishermichaeldark.dev

Weekly Downloads

Utility Dart library for GEDCOM tags and GEDCOM structures Dart Classes.

Repository (GitHub)
View/report issues

Topics

#gedcom #codec #parser

Documentation

API reference

License

MIT (license)

Dependencies

collection, gedcom_codec

More

Packages that depend on gedcom_structures