You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.2 KiB
102 lines
3.2 KiB
3 years ago
|
import 'API Clasess/TesoUserDetail.dart';
|
||
|
|
||
|
class TesoUser {
|
||
|
String userGUID;
|
||
|
String username;
|
||
|
String firstname;
|
||
|
String lastname;
|
||
|
String description;
|
||
|
String email;
|
||
|
String phonenumber;
|
||
|
String address;
|
||
|
String displaypicture;
|
||
|
DateTime dateOfBirth;
|
||
|
// ignore: non_constant_identifier_names
|
||
|
String thumbnail_dp;
|
||
|
String gold;
|
||
|
String silver;
|
||
|
String friends;
|
||
|
String gender;
|
||
|
String country;
|
||
|
|
||
|
TesoUser(
|
||
|
{this.userGUID,
|
||
|
this.username,
|
||
|
this.firstname,
|
||
|
this.lastname,
|
||
|
this.description,
|
||
|
this.address,
|
||
|
this.email,
|
||
|
this.dateOfBirth,
|
||
|
// ignore: non_constant_identifier_names
|
||
|
this.displaypicture,
|
||
|
this.phonenumber,
|
||
|
this.gold,
|
||
|
this.silver,
|
||
|
this.gender,
|
||
|
this.country,
|
||
|
// ignore: non_constant_identifier_names
|
||
|
this.thumbnail_dp,
|
||
|
this.friends});
|
||
|
|
||
|
TesoUser.fromJSON(Map<String, dynamic> json)
|
||
|
: username = json['username'],
|
||
|
userGUID = json['userGUID'],
|
||
|
firstname = json['firstname'],
|
||
|
lastname = json['lastname'],
|
||
|
description = json['description'],
|
||
|
dateOfBirth = json["dateOfBirth"] != null
|
||
|
? DateTime.tryParse(json["dateOfBirth"].toString())
|
||
|
: null,
|
||
|
address = json['address'],
|
||
|
phonenumber = json['phonenumber'],
|
||
|
email = json['email'],
|
||
|
gold = json['gold'],
|
||
|
silver = json['silver'],
|
||
|
gender = json['gender'],
|
||
|
country = json['country'],
|
||
|
friends = json['friends'],
|
||
|
thumbnail_dp = json['thumbnail_dp'];
|
||
|
|
||
|
Map<dynamic, dynamic> toJson() {
|
||
|
final Map<dynamic, dynamic> data = Map<dynamic, dynamic>();
|
||
|
data['username'] = this.username;
|
||
|
data['userguid'] = this.userGUID;
|
||
|
data['firstname'] = this.firstname;
|
||
|
data['lastname'] = this.lastname;
|
||
|
data['description'] = this.description;
|
||
|
data['address'] = this.address;
|
||
|
data["dateOfBirth"] = this.dateOfBirth.toIso8601String();
|
||
|
data['phonenumber'] = this.phonenumber;
|
||
|
data['thumbnail_dp'] = this.thumbnail_dp;
|
||
|
data['email'] = this.email;
|
||
|
data['gold'] = this.gold;
|
||
|
data['silver'] = this.silver;
|
||
|
data['gender'] = this.gender;
|
||
|
data['country'] = this.country;
|
||
|
data['friends'] = this.friends;
|
||
|
data['displaypicture'] = this.displaypicture;
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
String toString() {
|
||
|
return '{"userGUID": "$userGUID","username": "$username", "firstname": "$firstname","lastname": "$lastname", "description": "$description","address": "$address","phonenumber": "$phonenumber",' +
|
||
|
'"email": "$email", "gold": "$gold","silver": "$silver","friends":"$friends","gender":"$gender","country":"$country","thumbnail_dp":"$thumbnail_dp","dateOfBirth":"$dateOfBirth","displaypicture":"$displaypicture"}';
|
||
|
}
|
||
|
|
||
|
TesoUser.fromDETAIL(TesoUserDetail user)
|
||
|
: userGUID = user.userGUID,
|
||
|
username = user.username,
|
||
|
firstname = user.firstname,
|
||
|
lastname = user.surname,
|
||
|
address = user.address,
|
||
|
country = user.country,
|
||
|
description = user.description,
|
||
|
email = user.email,
|
||
|
gender = user.gender,
|
||
|
dateOfBirth = user.dateOfBirth,
|
||
|
phonenumber = user.phonenumber.toString(),
|
||
|
thumbnail_dp = user.thumbnailDp;
|
||
|
}
|