heruijun / flutter_boss

flutter仿BOSS直聘(二),大前端技术实现
970 stars 244 forks source link

Json parsing failure in message.dart company.dart job.dart List<dynamic > cannot to List<message > #3

Open ZukGit opened 6 years ago

ZukGit commented 6 years ago

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)
from : static List fromJson(String json) { return JSON .decode(json)['list'] .map((obj) => Job.fromMap(obj)) .toList(); }

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 .

abner27625 commented 6 years ago

return JSON .decode(json)['list'] .map((obj) => Job.fromMap(obj)) .toList(); }

map后面指定类型就OK了

hasonguo commented 6 years ago

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.

liuyu520707 commented 5 years ago

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