fromValue static method

ResourceCode fromValue(
  1. int? val, {
  2. ResourceCode? orElse,
})

Returns the ResourceCode associated with the given value.

Throws an error if no match is found.

Implementation

static ResourceCode fromValue(int? val, {ResourceCode? orElse}) {
  return values.firstWhere(
    (element) => element.value == val,
    orElse: orElse == null ? null : () => orElse,
  );
}