0%
常用语法表达式
1 2 3 4 5 6 7 8 9 10 11 12
| String a; print(a??'defaul value');
(){print()} ()=>print()
Map<String,dynamic> data={}; data['key']="value"; String a=data['key'];
String jsonStr= jsonEncode(<List>);
|
类
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| class DraftBean { String title = ""; String summary = ""; SoftAllBean soft = SoftAllBean(); List<StepBean> steps = [];
DraftBean();
DraftBean.fromJson(Map<String, dynamic> json) : title = json['title'], summary = json['summary'], soft = SoftAllBean.fromJson(json['soft']), steps = (json['steps'] as List).map((e) => StepBean.fromJson(e)).toList();
Map<String, dynamic> toJson() => {'title': title, 'summary': summary, 'soft': soft, 'steps': steps}; }
|