diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index e511033..8ea1144 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -7,16 +7,19 @@ class User extends Model { String email; String username; String password; - List roles; + final List roles = []; User( {String id, - String this.email, - String this.username, - String this.password, - List roles}) { + this.email, + this.username, + this.password, + List roles: const []}) { this.id = id; - this.roles = roles ?? []; + + if (roles != null) { + this.roles.addAll(roles); + } } factory User.fromJson(String json) => new User.fromMap(JSON.decode(json));