fromString static method

UserType fromString(
  1. String value
)

Converts a string to a UserType value.

Matches the input string (case-insensitive) to a UserType name. Returns UserType.consumer if no match is found.

Parameters:

  • value: The string to convert to a UserType.

Returns: The corresponding UserType value.

Implementation

static UserType fromString(String value) {
  return UserType.values.firstWhere(
    (e) => e.name == value.toLowerCase(),
    orElse: () => UserType.consumer,
  );
}