newDocument method

SchemaDocument newDocument(
  1. String label
)

Converts a Schema to a base SchemaDocument with its fields being set to the associated Kind from the underlying definition.

Implementation

SchemaDocument newDocument(String label) {
  var docFields = <SchemaDocumentValue>[];
  for (SchemaField f in fields) {
    final key = f.name;
    final kind = f.fieldKind;
    docFields.add(SchemaDocumentValue(key: key, kind: kind.kind));
  }
  return SchemaDocument(
    label: label,
    schemaDid: did,
    fields: docFields,
  );
}