Created
June 22, 2020 17:30
-
-
Save kauemurakami/811f14ee186b7b089b2db7e18e29cb6a to your computer and use it in GitHub Desktop.
Classe modelo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModel { | |
int id; | |
String title; | |
String body; | |
MyModel({ id, title, body}); | |
MyModel.fromJson(Map<String, dynamic> json){ | |
this.id = json['id']; | |
this.title = json['title']; | |
this.body = json['body']; | |
} | |
Map<String, dynamic> toJson(){ | |
final Map<String, dynamic> data = new Map<String, dynamic>(); | |
data['name'] = this.title; | |
data['body'] = this.body; | |
return data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment