fromString static method

OS? fromString(
  1. String? str
)

Implementation

static OS? fromString(String? str) {
  if (str == null) {
    return null;
  }
  try {
    return OS.values.firstWhere((e) => e.toString().split('.').last == str);
  } on Exception {
    return null;
  }
}