Skip to content

Instantly share code, notes, and snippets.

@kauemurakami
Created June 22, 2020 17:30
Show Gist options
  • Save kauemurakami/811f14ee186b7b089b2db7e18e29cb6a to your computer and use it in GitHub Desktop.
Save kauemurakami/811f14ee186b7b089b2db7e18e29cb6a to your computer and use it in GitHub Desktop.
Classe modelo
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