first commit
This commit is contained in:
44
滴滴淘/ddt_flutter/lib/model/IndexModel.dart
Normal file
44
滴滴淘/ddt_flutter/lib/model/IndexModel.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
class Index {
|
||||
int status;
|
||||
List<Body> body;
|
||||
|
||||
Index({this.status, this.body});
|
||||
|
||||
Index.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
if (json['body'] != null) {
|
||||
body = new List<Body>();
|
||||
json['body'].forEach((v) {
|
||||
body.add(new Body.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
if (this.body != null) {
|
||||
data['body'] = this.body.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Body {
|
||||
int id;
|
||||
String text;
|
||||
|
||||
Body({this.id, this.text});
|
||||
|
||||
Body.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
text = json['text'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['text'] = this.text;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user