106 lines
2.6 KiB
Dart
106 lines
2.6 KiB
Dart
class UserInfoModel {
|
|
String? mobileNumber;
|
|
String? id;
|
|
String? name;
|
|
String? image;
|
|
String? email;
|
|
String? username;
|
|
String? code;
|
|
int? credit;
|
|
double? income;
|
|
int? freeCredit;
|
|
String? cardNumber;
|
|
dynamic parent;
|
|
bool? login;
|
|
int? gift_credit;
|
|
List<Notifications>? notifications;
|
|
|
|
UserInfoModel(
|
|
{this.mobileNumber,
|
|
this.id,
|
|
this.name,
|
|
this.image,
|
|
this.email,
|
|
this.username,
|
|
this.code,
|
|
this.credit,
|
|
this.freeCredit,
|
|
this.login = false,
|
|
this.cardNumber,
|
|
this.parent,
|
|
this.income,
|
|
this.gift_credit,
|
|
this.notifications});
|
|
|
|
UserInfoModel.fromJson(Map<String, dynamic> json) {
|
|
mobileNumber = json['mobile_number'];
|
|
id = json['id'];
|
|
name = json['name'];
|
|
image = json['image'];
|
|
email = json['email'];
|
|
username = json['username'];
|
|
code = json['code'];
|
|
credit = json['credit'];
|
|
freeCredit = json['free_credit'];
|
|
cardNumber = (json['card_number'] as String?) != null &&
|
|
(json['card_number'] as String?)!.isEmpty
|
|
? null
|
|
: json['card_number'];
|
|
income = json['income'];
|
|
parent = json['parent'];
|
|
if (json['notifications'] != null) {
|
|
notifications = <Notifications>[];
|
|
json['notifications'].forEach((v) {
|
|
notifications!.add(Notifications.fromJson(v));
|
|
});
|
|
}
|
|
login = true;
|
|
gift_credit = json['gift_credit'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['mobile_number'] = mobileNumber;
|
|
data['id'] = id;
|
|
data['name'] = name;
|
|
data['image'] = image;
|
|
data['email'] = email;
|
|
data['username'] = username;
|
|
data['code'] = code;
|
|
data['credit'] = credit;
|
|
data['free_credit'] = freeCredit;
|
|
data['card_number'] = cardNumber;
|
|
data['parent'] = parent;
|
|
if (notifications != null) {
|
|
data['notifications'] = notifications!.map((v) => v.toJson()).toList();
|
|
}
|
|
data['gift_credit'] = gift_credit;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Notifications {
|
|
String? title;
|
|
String? message;
|
|
bool? seen;
|
|
String? createdAt;
|
|
|
|
Notifications({this.title, this.message, this.seen, this.createdAt});
|
|
|
|
Notifications.fromJson(Map<String, dynamic> json) {
|
|
title = json['title'];
|
|
message = json['message'];
|
|
seen = json['seen'];
|
|
createdAt = json['created_at'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['title'] = title;
|
|
data['message'] = message;
|
|
data['seen'] = seen;
|
|
data['created_at'] = createdAt;
|
|
return data;
|
|
}
|
|
}
|