fromNativeValue static method

Sandbox? fromNativeValue(
  1. String? value
)

Gets a possible Sandbox instance from a native value.

Implementation

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