init method
Initializes this content builder with the given descriptors.
This method:
- Registers the content type with the content system
- Collects all available layouts from descriptors
- 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);
}