grouped method

Groups entries by type, preserving source order within each group.

Keys are always emitted in the fixed order: feat → fix → other. Buckets with no entries are omitted from the result.

Implementation

Map<String, List<ReleaseNotesEntry>> grouped() {
  final buckets = <String, List<ReleaseNotesEntry>>{};
  for (final entry in entries) {
    buckets.putIfAbsent(entry.type, () => []).add(entry);
  }
  return {
    for (final type in _typeOrder)
      if (buckets.containsKey(type)) type: buckets[type]!,
  };
}