documentComponents method Null safety

  1. @mustCallSuper
  2. @override
void documentComponents(
  1. APIDocumentContext registry
)
@mustCallSuper, override

Tells this object to add its components to context.

You may register components with context in this method. The order in which components are registered does not matter.

Example:

    class Car implements APIComponentDocumenter {
      @override
      void documentComponents(APIDocumentContext context) {
        context.schema.register("Car", APISchemaObject.object({
          "make": APISchemaObject.string(),
          "model": APISchemaObject.string(),
          "year": APISchemaObject.integer(),
        }));
      }
    }

See APIDocumentContext for more details.

Implementation

@mustCallSuper
@override
void documentComponents(APIDocumentContext registry) {
  entryPoint.documentComponents(registry);

  (RuntimeContext.current[runtimeType] as ChannelRuntime)
      .getDocumentableChannelComponents(this)
      .forEach((component) {
    component!.documentComponents(registry);
  });
}