Dart 未处理的异常:错误状态:没有用于';签名';

Dart 未处理的异常:错误状态:没有用于';签名';,dart,flutter,Dart,Flutter,我试图使用内置值序列化json响应。 我创建了以下类: 1.在课堂上。 2.-信号源。 3.-序列化程序 该服务运行良好,我得到了以下回应: {"status": 200, "user_id": "****", "id_token": "****", "refresh_token": "****", "expires_in": 3600 } 问题是当我尝试序列化response.body时 当我尝试这样做时,会出现以下错误: [错误:flatter/lib/ui/ui\u da

我试图使用内置值序列化json响应。 我创建了以下类: 1.在课堂上。 2.-信号源。 3.-序列化程序

该服务运行良好,我得到了以下回应:

{"status": 200, 
 "user_id": "****", 
 "id_token": "****", 
 "refresh_token": "****", 
 "expires_in": 3600 }
问题是当我尝试序列化response.body时

当我尝试这样做时,会出现以下错误:

[错误:flatter/lib/ui/ui\u dart\u state.cc(148)]未处理的异常:错误状态:没有用于“SignIn”的序列化程序

这是我正在使用的代码: 1.签名

abstract class SignIn implements Built<SignIn, SignInBuilder>{
 static Serializer<SignIn> get serializer => _$signInSerializer;
 @nullable
 int get status;

 @BuiltValueField(wireName: 'user_id')
 String get userId;

 @BuiltValueField(wireName: 'id_token')
 String get idToken;

 @BuiltValueField(wireName: 'refresh_token')
 String get refreshToken;

 SignIn._();

 factory SignIn([updates(SignInBuilder b)]) = _$SignIn;

 static SignIn fromJson(String jsonString) {
  return serializers.deserializeWith(SignIn.serializer,
  json.decode(jsonString));
 }
} 
3.信号源

class SigninDataSource {

Future<SignIn> signIn ({
 String email = '***@hotmail.com',
 String apiKey = '****',
 String password = '****',
}) async {
 var url = "https://api-dev.com/signin";
 var body = json.decode('{"email": "$email", "password": 
          "$password"}');
 http.post(url, body: json.encode(body),
    headers: {
      "x-api-key": apiKey,
      "content-type" : "application/json",})
    .then((response) {
  print("Response status: ${response.statusCode}");
  print("Response body: ${response.body}");

  return SignIn.fromJson(response.body);

  }
 );
}
}
类标志数据源{
未来签约({
字符串email='***@hotmail.com',
字符串apiKey='***',
字符串密码='***',
})异步的{
变量url=”https://api-dev.com/signin";
var body=json.decode('{“email”:“$email”,“password”:
“$password”}”);
http.post(url,body:json.encode(body),
标题:{
“x-api-key”:apiKey,
“内容类型”:“应用程序/json”,})
.然后((回应){
打印(“响应状态:${Response.statusCode}”);
打印(“响应正文:${Response.body}”);
返回SignIn.fromJson(response.body);
}
);
}
}

我希望有人能帮助解决这个问题。

我发现了这个问题,它与我使用dart中的序列化程序库有关,而我必须使用我在应用程序中创建的序列化程序库。
class SigninDataSource {

Future<SignIn> signIn ({
 String email = '***@hotmail.com',
 String apiKey = '****',
 String password = '****',
}) async {
 var url = "https://api-dev.com/signin";
 var body = json.decode('{"email": "$email", "password": 
          "$password"}');
 http.post(url, body: json.encode(body),
    headers: {
      "x-api-key": apiKey,
      "content-type" : "application/json",})
    .then((response) {
  print("Response status: ${response.statusCode}");
  print("Response body: ${response.body}");

  return SignIn.fromJson(response.body);

  }
 );
}
}