mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
fix null condition
This commit is contained in:
@@ -59,7 +59,6 @@ class SearchPageData
|
|||||||
if (rsp.code != 0) {
|
if (rsp.code != 0) {
|
||||||
throw rsp.message;
|
throw rsp.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sp = SearchResponse.fromJson(rsp.data);
|
var sp = SearchResponse.fromJson(rsp.data);
|
||||||
return sp.results ?? List.empty();
|
return sp.results ?? List.empty();
|
||||||
}
|
}
|
||||||
@@ -117,7 +116,7 @@ class SearchResponse {
|
|||||||
page: json["page"],
|
page: json["page"],
|
||||||
totalPage: json["total_page"],
|
totalPage: json["total_page"],
|
||||||
totalResults: json["total_results"],
|
totalResults: json["total_results"],
|
||||||
results: (json["results"] as List)
|
results: json["results"] == null ? []: json["results"]
|
||||||
.map((v) => SearchResult.fromJson(v))
|
.map((v) => SearchResult.fromJson(v))
|
||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user