fromName static method

AccountType? fromName(
  1. String? name
)

Returns the AccountType associated with the given name.

Returns null if no match is found.

Implementation

static AccountType? fromName(String? name) {
  if (name == null) return null;
  try {
    return values.firstWhere((element) => element.name == name);
  } on StateError {
    return null;
  } catch (e) {
    return null;
  }
}