【发布时间】:2022-09-23 21:22:50
【问题描述】:
我正在寻找一个元素。我正在使用自动完成小部件,用户可以在其中键入并根据匹配的结果显示建议。我的数据来自 Post 请求。早些时候有一个 Get 请求和 AutoComplete 建议对我有用,但现在它已更改为 Post 请求。
因此,现在我收到此错误Instance member \'res\' can\'t be accessed using static access
这是我的 search_model.dart
SearchSquad searchSquadFromJson(String str) =>
SearchSquad.fromJson(json.decode(str));
String searchSquadToJson(SearchSquad data) => json.encode(data.toJson());
class SearchSquad {
SearchSquad({
required this.count,
required this.res,
});
int count;
List<Re> res;
factory SearchSquad.fromJson(Map<String, dynamic> json) => SearchSquad(
count: json[\"count\"],
res: List<Re>.from(json[\"res\"].map((x) => Re.fromJson(x))),
);
Map<String, dynamic> toJson() => {
\"count\": count,
\"res\": List<dynamic>.from(res.map((x) => x.toJson())),
};
}
class Re {
Re({
required this.squadId,
required this.squadName,
required this.defaultProfileImageId,
required this.profimgid,
required this.profimgname,
required this.profimgurl,
required this.profimgrotation,
this.profimgposition1,
this.profimgposition2,
required this.profimgscale,
this.profimgrotationfocuspoint1,
this.profimgrotationfocuspoint2,
});
String squadId;
String squadName;
String defaultProfileImageId;
String profimgid;
String profimgname;
String profimgurl;
int profimgrotation;
dynamic profimgposition1;
dynamic profimgposition2;
double profimgscale;
dynamic profimgrotationfocuspoint1;
dynamic profimgrotationfocuspoint2;
标签: flutter flutter-layout flutter-web