getUsedThreshold function
Implementation
int getUsedThreshold(
String password,
String entry,
int threshold,
) {
bool isPasswordToShort = password.length <= entry.length;
bool isThresholdLongerThanPassword = password.length <= threshold;
bool shouldUsePasswordLength =
isPasswordToShort || isThresholdLongerThanPassword;
// if password is too small use the password length divided by 4 while the
// threshold needs to be at least 1
return shouldUsePasswordLength ? (password.length / 4).ceil() : threshold;
}