PrismVersion.parse constructor
PrismVersion.parse(
- String input
Parses a version string such as 1.2.3, 1.2.3+4, or v2.0.
Non-numeric components are ignored. Throws PrismVersionException when no numeric components can be extracted.
Implementation
factory PrismVersion.parse(String input) {
final cleaned = input.trim().replaceFirst(RegExp(r'^[vV]\s*'), '');
final parts = cleaned
.split(RegExp(r'[.\s+\-]'))
.map((p) => int.tryParse(p))
.whereType<int>()
.toList(growable: false);
if (parts.isEmpty) {
throw PrismVersionException(input);
}
return PrismVersion(List<int>.unmodifiable(parts));
}