Update user.dart
This commit is contained in:
parent
bbe19a900c
commit
14b031a608
1 changed files with 9 additions and 6 deletions
|
@ -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));
|
||||||
|
|
Loading…
Reference in a new issue