Flutter 无法获取跟踪ID

Flutter 无法获取跟踪ID,flutter,dart,Flutter,Dart,我试图在PinCodeTextField中获取跟踪ID以验证电子邮件,但收到此错误“responseCode”:2,“消息”:“验证失败,请重试” 好的,对不起,我忘了和这个。这是我的回复电子邮件 import 'dart:convert'; ResponseVerifyEmail responseVerifyEmailFromJson(String str) => ResponseVerifyEmail.fromJson(json.decode(str)); String resp

我试图在
PinCodeTextField
中获取跟踪ID以验证电子邮件,但收到此错误
“responseCode”:2,“消息”:“验证失败,请重试”

好的,对不起,我忘了和这个。这是我的回复电子邮件

import 'dart:convert';


ResponseVerifyEmail responseVerifyEmailFromJson(String str) => ResponseVerifyEmail.fromJson(json.decode(str));

String responseVerifyEmailToJson(ResponseVerifyEmail data) => json.encode(data.toJson());

class ResponseVerifyEmail {
    ResponseVerifyEmail({
        this.data,
        this.responseCode,
        this.message,
    });

    Data data;
    int responseCode;
    String message;

    factory ResponseVerifyEmail.fromJson(Map<String, dynamic> json) => ResponseVerifyEmail(
        data: Data.fromJson(json["data"]),
        responseCode: json["responseCode"],
        message: json["message"],
    );

    Map<String, dynamic> toJson() => {
        "data": data.toJson(),
        "responseCode": responseCode,
        "message": message,
    };
}

class Data {
    Data({
        this.trackingId,
    });

    String trackingId;

    factory Data.fromJson(Map<String, dynamic> json) => Data(
        trackingId: json["trackingId"],
    );

    Map<String, dynamic> toJson() => {
        "trackingId": trackingId,
    };
}
ResponseData responseDataFromJson(String str) =>
    ResponseData.fromJson(json.decode(str));

String responseDataToJson(ResponseData data) => json.encode(data.toJson());

class ResponseData {
  ResponseData({
    this.responseCode,
    this.message,
  });

  int responseCode;
  String message;

  factory ResponseData.fromJson(Map<String, dynamic> json) => ResponseData(
        responseCode: json["responseCode"],
        message: json["message"],
      );

  Map<String, dynamic> toJson() => {
        "responseCode": responseCode,
        "message": message,
      };
}
}

这就是我使用的提供者,这就是我使用逻辑的地方

我使用下面的代码访问跟踪ID
UserOnboardingModel\u UserOnboardingModel=UserOnboardingModel()

Future pinCode(v)异步{
应答数据结果;
结果=等待存储库。VerifyEmailVerificationOnTP(
OTP验证模型(
trackingId:_userOnboardingModel.trackingId,pin:v));
var text=result.message;
var responseCode=result.responseCode;
如果(响应代码==1){
isVerified=true;
}else if(responseCode==2){
isVerified=false;
}
信息=文本;
展示土司(信息);
notifyListeners();
}
这就是我创建的视图

Consumer<OtpModel>(
          builder: (context, mOtpModel, child) => PinCodeTextField(
            onCompleted: (value) async{
              await mOtpModel.pinCode(value);
              if(mOtpModel.isLoading){
                return CircularProgressIndicator();
              }
              if(mOtpModel.isVerified){
                Navigator.pushNamed(context, SignUpView.SIGN_UP_ROUTE);
              }
            },
            mainAxisAlignment: MainAxisAlignment
                .spaceEvenly, //controls the space between each field
            pinTheme: PinTheme.defaults(
                borderWidth: 1.0,
                inactiveColor: Colors.black,
                activeColor: _greenColor,
                selectedColor: Colors.black), //used to format the input field

            textStyle: TextStyle(
                fontSize: 36,
                fontWeight: FontWeight.bold,
                fontFamily: 'Inter'),
            length: 4,
            onChanged: (value) {}, appContext: null,
          ),
        ),
消费者(
生成器:(上下文、mOtpModel、子项)=>PinCodeTextField(
未完成:(值)异步{
等待mOtpModel.pinCode(值);
if(mOtpModel.isLoading){
返回循环ProgressIndicator();
}
如果(mOtpModel.isVerified){
Navigator.pushNamed(上下文,SignUpView.SIGN\u-UP\u-ROUTE);
}
},
mainAxisAlignment:mainAxisAlignment
.space,//控制每个字段之间的间距
pinTheme:pinTheme.defaults(
边框宽度:1.0,
不活动颜色:颜色。黑色,
activeColor:\u绿色,
selectedColor:Colors.black),//用于设置输入字段的格式
textStyle:textStyle(
尺寸:36,
fontWeight:fontWeight.bold,
fontFamily:‘国际’,
长度:4,
onChanged:(值){},appContext:null,
),
),
因此,对于要移动到下一屏幕的
PinCodeTextField
,它已验证pin和跟踪ID,但抛出此错误:
responseCode]:2,“消息”:“验证失败,请重试”

请帮我弄清楚

    Future<void> pinCode(v) async {
    ResponseData result;
    result = await repository.verifyEmailVerificationOtp(
        OtpVerificationModel(
            trackingId: _userOnboardingModel.trackingId, pin: v));

    var text = result.message;
    var responseCode = result.responseCode;

    if (responseCode == 1) {
      isVerified = true;
    } else if (responseCode == 2) {
      isVerified = false;
    }
    message = text;
    showToast(message);

    notifyListeners();
  }
Consumer<OtpModel>(
          builder: (context, mOtpModel, child) => PinCodeTextField(
            onCompleted: (value) async{
              await mOtpModel.pinCode(value);
              if(mOtpModel.isLoading){
                return CircularProgressIndicator();
              }
              if(mOtpModel.isVerified){
                Navigator.pushNamed(context, SignUpView.SIGN_UP_ROUTE);
              }
            },
            mainAxisAlignment: MainAxisAlignment
                .spaceEvenly, //controls the space between each field
            pinTheme: PinTheme.defaults(
                borderWidth: 1.0,
                inactiveColor: Colors.black,
                activeColor: _greenColor,
                selectedColor: Colors.black), //used to format the input field

            textStyle: TextStyle(
                fontSize: 36,
                fontWeight: FontWeight.bold,
                fontFamily: 'Inter'),
            length: 4,
            onChanged: (value) {}, appContext: null,
          ),
        ),