DarwinVersion.fromString constructor
DarwinVersion.fromString(
- String text
Constructs a DarwinVersion from String.
Implementation
factory DarwinVersion.fromString(String text) {
final texts = text.split('.');
final majorText = texts.elementAtOrNull(0);
final minorText = texts.elementAtOrNull(1);
final patchText = texts.elementAtOrNull(2);
final majorVersion = majorText == null ? 0 : int.parse(majorText);
final minorVersion = minorText == null ? 0 : int.parse(minorText);
final patchVersion = patchText == null ? 0 : int.parse(patchText);
return DarwinVersion(
majorVersion: majorVersion,
minorVersion: minorVersion,
patchVersion: patchVersion,
);
}