fromValue static method

Sandbox? fromValue(
  1. String? value
)

Gets a possible Sandbox instance from a String value.

Implementation

static Sandbox? fromValue(String? value) {
  if (value == null) {
    return Sandbox._ALL;
  } else if (value == "") {
    return Sandbox._NONE;
  }
  try {
    return Sandbox.values.firstWhere((element) => element.toValue() == value);
  } catch (e) {
    return null;
  }
}