Skip to content

Instantly share code, notes, and snippets.

@fatihkurcenli
Last active November 5, 2020 13:19
Show Gist options
  • Save fatihkurcenli/ecc702dfa8e317ff9e15237072bef59a to your computer and use it in GitHub Desktop.
Save fatihkurcenli/ecc702dfa8e317ff9e15237072bef59a to your computer and use it in GitHub Desktop.
PostModel.dart
class PostModel {
int userId;
int id;
String title;
String body;
PostModel({this.userId, this.id, this.title, this.body});
PostModel.fromJson(Map<String, dynamic> json) {
userId = json['userId'];
id = json['id'];
title = json['title'];
body = json['body'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['userId'] = this.userId;
data['id'] = this.id;
data['title'] = 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