IPLDSchema constructor

IPLDSchema(
  1. String name,
  2. Map<String, dynamic> _schema, {
  3. IPLDLinkResolver? linkResolver,
  4. Map<String, Object?>? adlTypes,
})

Creates an IPLD schema with name and schema definition.

schema maps type names to type declarations, each a Map with a kind key plus kind-specific members. The reserved key advanced may hold a Map of ADL names to the type terms that describe their data-model nodes.

linkResolver is the default resolver used by validate and checkAsync when a link type carries expectedType; passing a resolver per call overrides it. adlTypes registers extra ADL schemas — values are type terms (a type name or an inline kind definition) resolved in this schema, or an IPLDSchema whose ADL-named type is checked directly.

Throws IPLDSchemaError immediately when a representation clause explicitly references an ADL name that is declared neither in the schema's advanced block nor in adlTypes.

Implementation

IPLDSchema(
  this.name,
  this._schema, {
  IPLDLinkResolver? linkResolver,
  Map<String, Object?>? adlTypes,
}) : _linkResolver = linkResolver,
     _adlTypes = adlTypes {
  _lintAdvancedDeclarations();
}