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 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 toJson() { final Map data = Map(); 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"}'; } }