fromEntries static method

CombiningBuilderEntry fromEntries(
  1. List<BuilderEntryImpl> entries
)

Creates a CombiningBuilderEntry from a list of BuilderEntryImpls.

This factory method combines multiple builder entries into a single combined entry, merging their configuration and builders.

entries The list of builder entries to combine.

Returns a new CombiningBuilderEntry that combines the given entries.

Implementation

static CombiningBuilderEntry fromEntries(List<BuilderEntryImpl> entries) {
  final String key = entries.map((BuilderEntryImpl e) => e.key).join('|');
  final List<Builder> builders = entries.map((BuilderEntryImpl e) => e.builder).toList();
  final Map<Type, String> annotationsTypeMap = <Type, String>{
    for (final BuilderEntryImpl entry in entries) ...entry.registeredTypes,
  };

  return CombiningBuilderEntry(
    builders: builders,
    key: key,
    generateFor: entries.expand((BuilderEntryImpl e) => e.generateFor).toSet(),
    runsBefore: entries.expand((BuilderEntryImpl e) => e.runsBefore).toSet(),
    annotationsTypeMap: annotationsTypeMap,
    applies: entries.expand((BuilderEntryImpl e) => e.applies).toSet(),
  );
}