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.
 
 

81 lines
2.5 KiB

import 'package:teso/Classes/TesoUser.dart';
class TesoUserDetail {
String userGUID;
String username;
String firstname;
String surname;
String description;
String address;
String email;
String thumbnailDp;
String phonenumber;
String country;
String gender;
DateTime dateOfBirth;
TesoUserDetail(
{this.username,
this.userGUID,
this.firstname,
this.surname,
this.address,
this.country,
this.description,
this.dateOfBirth,
this.email,
this.gender,
this.phonenumber,
this.thumbnailDp});
TesoUserDetail.fromJSON(Map<String, dynamic> json)
: username = json['username'],
userGUID = json['userGUID'],
firstname = json['firstname'],
surname = json['surname'],
address = json['address'],
country = json['country'],
dateOfBirth = DateTime.tryParse(json["dateOfBirth"].toString()),
description = json['description'],
email = json['email'],
gender = json['gender'],
phonenumber = json['phonenumber'],
thumbnailDp = json['thumbnailDp'];
TesoUserDetail.fromUSER(TesoUser user)
: userGUID = user.userGUID,
username = user.username,
firstname = user.firstname,
surname = user.lastname,
address = user.address,
country = user.country,
dateOfBirth = user.dateOfBirth,
description = user.description,
email = user.email,
gender = user.gender,
phonenumber = user.phonenumber,
thumbnailDp = user.thumbnail_dp;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = Map<String, dynamic>();
data['username'] = this.username;
data['userGUID'] = this.userGUID;
data['firstname'] = this.firstname;
data['surname'] = this.surname;
data['description'] = this.description;
data['address'] = this.address;
data['phonenumber'] = this.phonenumber;
data['dateOfBirth'] = this.dateOfBirth.toIso8601String();
data['thumbnailDp'] = this.thumbnailDp;
data['email'] = this.email;
data['gender'] = this.gender;
data['country'] = this.country;
return data;
}
@override
String toString() {
return '{"userGUID": "$userGUID","firstname": "$firstname", "username": "$username","surname": "$surname", "description": "$description", "address": "$address", "phonenumber": "$phonenumber",' +
'"thumbnailDp": "$thumbnailDp","email": "$email","gender": "$gender","country": "$country","dateOfBirth":"$dateOfBirth"}';
}
}