error_code.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import '../../resource/string.gen.dart';
  2. class ErrorCode {
  3. /// 登录相关错误码
  4. static const int verificationCodeError = 1005; //验证码错误
  5. static const int noLoginError = 1006; //未登录
  6. static const int noMember = 1007; //没有会员
  7. /// 好友关系相关错误码
  8. static const int friendNotRegistered = 1100; //好友未注册本应用
  9. static const int friendRequestSent = 1101; //好友申请已发出,请等待对方通过
  10. static const int alreadyInFriendList = 1102; //该好友已在好友列表
  11. static const int cannotAddSelf = 1103; //不能添加自己为好友
  12. /// 紧急联系人相关错误码
  13. static const int maxContactsReached = 1200; // 最多添加5人,请移除后再添加
  14. static const int contactAlreadyAdded = 1201; //对方已是您的紧急联系人
  15. static const int smsSendFailed = 1202; //短信发送失败,请核实手机号码
  16. /// 会员服务相关错误码
  17. static const int getMemberFree = 1300; //每位用户只能领取一次试用
  18. static const int isMember = 1301; //您已经是会员了
  19. static const int payOrderError = 1004;
  20. }
  21. /// 错误码扩展方法
  22. extension ErrorDescription on int {
  23. String? get description {
  24. switch (this) {
  25. case ErrorCode.noLoginError:
  26. return StringName.accountNoLogin;
  27. }
  28. return null;
  29. }
  30. }