每个人,几天来我对这个问题感到困惑,有人可以帮助我吗? 当我使用flutter redux时,我遇到了这个问题。
将“ [数据,{帐户:[],版本:5.4},空,空]”反序列化为“ LoginResponse”失败,原因是:无效 参数:反序列化的未知类型。需要requiredType或discriminator字段。
这是LoginResponse反序列化方法:
LoginResponse deserialize(Serializers serializers, Iterable serialized,
{FullType specifiedType: FullType.unspecified}) {
final result = new LoginResponseBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final dynamic value = iterator.current;
switch (key) {
case 'data':
result.data.replace(serializers.deserialize(value, specifiedType: const FullType(LoginResponseData)) as LoginResponseData);
break;
case 'error':
result.error.replace(serializers.deserialize(value,
specifiedType: const FullType(ErrorMessage)) as ErrorMessage);
break;
}
}
return result.build();
}
abstract class LoginResponseData implements Built<LoginResponseData, LoginResponseDataBuilder> {
factory LoginResponseData([void updates(LoginResponseDataBuilder b)]) = _$LoginResponseData;
LoginResponseData._();
BuiltList<CompanyEntity> get accounts;
String get version;
static Serializer<LoginResponseData> get serializer => _$loginResponseDataSerializer;
}
真正让我难受的是android studio的调试模式似乎有问题吗?某些变量始终显示“正在收集数据...我很难解决此问题,因为我无法获取某些关键变量的值。就像:specifiedType。
调试时有一些屏幕截图。
如果有人可以给我一些提示或答案,我将非常感谢!!!谢谢!!!