From 14b031a608934906d471c03123a58baaa2f146d2 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 4 Dec 2016 20:22:41 -0500 Subject: [PATCH] Update user.dart --- lib/src/models/user.dart | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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));