// Description: 验证码渠道枚举类 class VerificationCodeChannel { static const sms = VerificationCodeChannel('1', '短信'); static const email = VerificationCodeChannel('2', '邮箱'); final String value; final String label; const VerificationCodeChannel(this.value, this.label); // 支持通过字符串值查找枚举实例 static VerificationCodeChannel? fromValue(String? value) { return { '1': sms, '2': email, }[value]; } // 支持 toString() 直接输出 value @override String toString() => value; // 可选:支持 == 比较 @override bool operator ==(Object other) => identical(this, other) || other is VerificationCodeChannel && runtimeType == other.runtimeType && value == other.value; @override int get hashCode => value.hashCode; }