Skip to content

Instantly share code, notes, and snippets.

@bardiarastin
Last active February 6, 2020 19:00
Show Gist options
  • Save bardiarastin/92a3d6bc6274fb074b6074004329830d to your computer and use it in GitHub Desktop.
Save bardiarastin/92a3d6bc6274fb074b6074004329830d to your computer and use it in GitHub Desktop.
class IPost {
int id;
int userId;
String title;
String body;
IPost.fromJson(Map<String, dynamic> json) {
if (json == null) return;
id = json['id'];
userId = json['userId'];
title = json['title'];
body = json['body'];
}
static List<IPost> listFromJson(List<dynamic> json) {
return json == null ? List<IPost>() : json.map((value) => IPost.fromJson(value)).toList();
}
}
@smhmayboudi
Copy link

Sorry, my mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment