Update user.dart

This commit is contained in:
Tobe O 2016-12-04 20:19:03 -05:00 committed by GitHub
parent 7829666277
commit f36d145c7a

View file

@ -10,16 +10,19 @@ class User extends Model {
List<String> roles; List<String> roles;
User( User(
{String this.email, {String id,
String this.email,
String this.username, String this.username,
String this.password, String this.password,
List<String> roles}) { List<String> roles}) {
this.id = id;
this.roles = roles ?? []; this.roles = roles ?? [];
} }
factory User.fromJson(String json) => new User.fromMap(JSON.decode(json)); factory User.fromJson(String json) => new User.fromMap(JSON.decode(json));
factory User.fromMap(Map data) => new User( factory User.fromMap(Map data) => new User(
id: data['id'],
email: data["email"], email: data["email"],
username: data["username"], username: data["username"],
password: data["password"], password: data["password"],
@ -27,6 +30,7 @@ class User extends Model {
Map toJson() { Map toJson() {
return { return {
"id": id,
"email": email, "email": email,
"username": username, "username": username,
"password": password, "password": password,