forUserAttribute static method

Strategy forUserAttribute(
  1. UserAttribute attr
)

For a given UserAttribute, return an appropriate Strategy, or throw an error

Implementation

static Strategy forUserAttribute(UserAttribute attr) {
  return switch (attr) {
    UserAttribute.phoneNumber => Strategy.phoneCode,
    UserAttribute.emailAddress => Strategy.emailCode,
    _ => throw ClerkError(
        message: 'No strategy associated with {arg}',
        argument: attr.name,
        code: ClerkErrorCode.noAssociatedStrategy,
      ),
  };
}