class PasswordPolicy { static const defaultPassword = 'Cc@12345678'; static final RegExp _validPassword = RegExp( r'^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!#@*&])[A-Za-z\d!#@*&]{8,16}$', ); static bool requiresChange(String? password) { return password == defaultPassword; } static String? validate(String password) { if (_validPassword.hasMatch(password)) { return null; } return '密码长度为8-16位,且必须包含大写字母、小写字母、数字和特殊符号(!#@*&)。'; } }