isStrongPassword static method

bool isStrongPassword(
  1. String? password
)

验证密码强度(至少8位,包含数字和字母)

Implementation

static bool isStrongPassword(String? password) {
  if (password?.isEmpty ?? true) return false;
  final passwordRegex =
      RegExp(r'^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d@$!%*#?&]{8,}$');
  return passwordRegex.hasMatch(password!);
}