Open ZukGit opened 6 years ago
return JSON
.decode(json)['list']
.map
map后面指定类型就OK了
When I git clone this project , I find that it cause a RuntimeException , and message company job Page is Empty ! how can I to resolve it.
static List fromJson(String json) { return JSON .decode(json)['list'] .map((obj) => Job.fromMap(obj)) .toList(); }
static List fromJson(String json) json => str
JSON => json
When I git clone this project , I find that it cause a RuntimeException , and message company job Page is Empty ! I find that I change method fromJson(String json) fromJson(String json) {
return JSON
.decode(json)['list']
.map((obj) => Job.fromMap(obj))
.toList();
}
from : static List
to: static List fromJson(String json) {
List _jobs = [];
for (var value in new JsonDecoder().convert(json)['list']) {
_jobs.add(Job.fromMap(value));
}
return _jobs;
}
and make method buildJobItem return Widget , The Project work well .