Created
August 6, 2018 18:52
-
-
Save paulallies/30977e5dfdd32ad99d09b6dd5a6bc963 to your computer and use it in GitHub Desktop.
User class
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 User { | |
int id; | |
String name; | |
String email; | |
User(int id, String name, String email) { | |
this.id = id; | |
this.name = name; | |
this.email = email; | |
} | |
User.fromJson(Map json) | |
: id = json['id'], | |
name = json['name'], | |
email = json['email']; | |
Map toJson() { | |
return {'id': id, 'name': name, 'email': email}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment