init method

  1. @mustCallSuper
void init(
  1. List<ContentDescriptor> descriptors
)

Initializes this content builder with the given descriptors.

This method:

  1. Registers the content type with the content system
  2. Collects all available layouts from descriptors
  3. Registers layout types with the content system

Must be called before using the builder.

Implementation

@mustCallSuper
void init(List<ContentDescriptor> descriptors) {
  VyuhBinding.instance.content.register<ContentItem>(content);

  final userLayouts = descriptors.expand((element) =>
      element.layouts ?? <TypeDescriptor<LayoutConfiguration>>[]);
  final layouts = <TypeDescriptor<LayoutConfiguration>>{
    defaultLayoutDescriptor,
    ...userLayouts,
  }.toList(growable: false);

  _layouts
    ..clear()
    ..addAll(layouts);

  registerDescriptors<LayoutConfiguration>(layouts);
}