Flutter 未处理的异常:类型'_内部链接dhashmap<;动态,动态>';不是类型为';地图<;字符串,动态>';飞镖
我试图解析json响应,但我有这个错误,我不知道为什么。错误发生在数据对象内部。因为当我移除这个物体时,它工作得非常好。我需要知道我做错了什么Flutter 未处理的异常:类型'_内部链接dhashmap<;动态,动态>';不是类型为';地图<;字符串,动态>';飞镖,flutter,dart,Flutter,Dart,我试图解析json响应,但我有这个错误,我不知道为什么。错误发生在数据对象内部。因为当我移除这个物体时,它工作得非常好。我需要知道我做错了什么 class TripDetails { String operatorId; String title; String body; Data data; TripDetails({this.operatorId, this.title, this.body, this.data}); TripDetails.fromJson(
class TripDetails {
String operatorId;
String title;
String body;
Data data;
TripDetails({this.operatorId, this.title, this.body, this.data});
TripDetails.fromJson(Map<String, dynamic> json) {
operatorId = json['operatorId'];
title = json['title'];
body = json['body'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
}
class Data {
String clickAction;
String tripId;
String tripType;
String date;
String earning;
String distance;
String stores;
Data(
{this.clickAction,
this.tripId,
this.tripType,
this.date,
this.earning,
this.distance,
this.stores});
Data.fromJson(Map<String, dynamic> json) {
clickAction = json['click_action'];
tripId = json['tripId'];
tripType = json['trip_type'];
date = json['date'];
earning = json['earning'];
distance = json['distance'];
stores = json['stores'];
}
更改此项:
Data.fromJson(Map<String, dynamic> json) {
发布解析代码。
Data.fromJson(Map<String, dynamic> json) {
Data.fromJson(Map json) {