getVersionsInRange method
Get all versions from a list that fall between two versions
(exclusive of fromVersion, inclusive of toVersion).
The returned list is sorted in ascending order.
Implementation
List<String> getVersionsInRange(
List<String> allVersions,
String fromVersion,
String toVersion,
) {
final from = Version.parse(fromVersion);
final to = Version.parse(toVersion);
return allVersions.where((v) {
try {
final ver = Version.parse(v);
return ver > from && ver <= to;
} catch (_) {
return false;
}
}).toList()
..sort((a, b) => Version.parse(a).compareTo(Version.parse(b)));
}