byName static method

URLProtectionSpaceAuthenticationMethod? byName(
  1. String? name
)

Gets a possible URLProtectionSpaceAuthenticationMethod instance value with name name.

Goes through URLProtectionSpaceAuthenticationMethod.values looking for a value with name name, as reported by URLProtectionSpaceAuthenticationMethod.name. Returns the first value with the given name, otherwise null.

Implementation

static URLProtectionSpaceAuthenticationMethod? byName(String? name) {
  if (name != null) {
    try {
      return URLProtectionSpaceAuthenticationMethod.values.firstWhere(
        (element) => element.name() == name,
      );
    } catch (e) {
      return null;
    }
  }
  return null;
}