getEntriesBetween method
List<ChangelogEntry>
getEntriesBetween(
- List<
ChangelogEntry> entries, - String fromVersion,
- String toVersion
Get entries between two versions (exclusive of fromVersion, inclusive of
toVersion).
Assumes entries are ordered newest-first (as returned by parse).
Returns entries in the same newest-first order.
Implementation
List<ChangelogEntry> getEntriesBetween(
List<ChangelogEntry> entries,
String fromVersion,
String toVersion,
) {
if (entries.isEmpty) return [];
// Build a simple comparable representation for version comparison.
// We rely on string matching for boundary detection, then filter.
final fromParts = _parseVersionParts(fromVersion);
final toParts = _parseVersionParts(toVersion);
if (fromParts == null || toParts == null) {
Logger.warn(
'ChangelogParser: could not parse version range '
'$fromVersion..$toVersion',
);
return [];
}
return entries.where((entry) {
final parts = _parseVersionParts(entry.version);
if (parts == null) return false;
// Exclusive of fromVersion, inclusive of toVersion.
return _compareVersionParts(parts, fromParts) > 0 &&
_compareVersionParts(parts, toParts) <= 0;
}).toList();
}