toPasswordError method

PasswordError toPasswordError()

Maps a validation issue to its domain PasswordError equivalent.

Implementation

PasswordError toPasswordError() => switch (this) {
  v.PasswordEmptyIssue() => const PasswordEmpty(),
  v.PasswordTooShortIssue(:final currentLength, :final minLength) =>
    PasswordTooShort(currentLength: currentLength, minLength: minLength),
  v.PasswordTooLongIssue(:final currentLength, :final maxLength) =>
    PasswordTooLong(currentLength: currentLength, maxLength: maxLength),
  v.PasswordMissingUppercaseIssue() => const PasswordTooWeak(),
  v.PasswordMissingLowercaseIssue() => const PasswordTooWeak(),
  v.PasswordMissingDigitIssue() => const PasswordTooWeak(),
  v.PasswordMissingSpecialCharacterIssue() => const PasswordTooWeak(),
  v.PasswordTooCommonIssue() => const PasswordTooCommon(),
  v.PasswordRepeatedCharacterIssue() => const PasswordTooPredictable(),
  v.PasswordSequentialPatternIssue() => const PasswordTooPredictable(),
};