Update user.dart
This commit is contained in:
parent
7829666277
commit
f36d145c7a
1 changed files with 5 additions and 1 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue