fromName static method

ResourceCode? fromName(
  1. String? name, {
  2. ResourceCode? orElse,
})

Returns the ResourceCode associated with the given name.

Returns null if no match is found.

Implementation

static ResourceCode? fromName(String? name, {ResourceCode? orElse}) {
  try {
    return values.firstWhere(
      (element) => element.name == name,
      orElse: orElse == null ? null : () => orElse,
    );
  } on StateError {
    return null;
  }
}