newDocument method Null safety

SchemaDocument newDocument()

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

Implementation

SchemaDocument newDocument() {
  return SchemaDocument(
    creator: creator,
    did: did,
    definition: this,
    fields: List<SchemaDocumentValue>.generate(fields.length, (index) {
      return SchemaDocumentValue(
        name: fields[index].name,
        field_2: fields[index].field_2,
      );
    }),
  );
}