Update user.dart

This commit is contained in:
Tobe O 2016-12-04 20:22:41 -05:00 committed by GitHub
parent bbe19a900c
commit 14b031a608

View file

@ -7,16 +7,19 @@ class User extends Model {
String email; String email;
String username; String username;
String password; String password;
List<String> roles; final List<String> roles = [];
User( User(
{String id, {String id,
String this.email, this.email,
String this.username, this.username,
String this.password, this.password,
List<String> roles}) { List<String> roles: const []}) {
this.id = id; this.id = id;
this.roles = roles ?? [];
if (roles != null) {
this.roles.addAll(roles);
}
} }
factory User.fromJson(String json) => new User.fromMap(JSON.decode(json)); factory User.fromJson(String json) => new User.fromMap(JSON.decode(json));