Initial commit: Penyerahan final Source code Tugas Akhir
This commit is contained in:
105
lib/models/data_diri_model.dart
Normal file
105
lib/models/data_diri_model.dart
Normal file
@ -0,0 +1,105 @@
|
||||
class DataDiriModel {
|
||||
DataDiriModel({
|
||||
this.status,
|
||||
this.error,
|
||||
required this.data,
|
||||
});
|
||||
|
||||
int? status;
|
||||
bool? error;
|
||||
List<DataOfDataDiriModel> data;
|
||||
|
||||
factory DataDiriModel.fromJson(Map<String, dynamic> json) => DataDiriModel(
|
||||
status: json["status"],
|
||||
error: json["error"],
|
||||
data: List<DataOfDataDiriModel>.from(
|
||||
json["data"].map((x) => DataOfDataDiriModel.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"status": status,
|
||||
"error": error,
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class DataOfDataDiriModel {
|
||||
DataOfDataDiriModel({
|
||||
this.idUser,
|
||||
this.fullname,
|
||||
this.headline,
|
||||
this.biography,
|
||||
this.datebirth,
|
||||
this.email,
|
||||
this.phone,
|
||||
this.gender,
|
||||
this.socialLink,
|
||||
});
|
||||
|
||||
String? idUser;
|
||||
String? fullname;
|
||||
String? headline;
|
||||
String? biography;
|
||||
String? datebirth;
|
||||
String? email;
|
||||
String? phone;
|
||||
String? gender;
|
||||
SocialLink? socialLink;
|
||||
|
||||
factory DataOfDataDiriModel.fromJson(Map<String, dynamic> json) =>
|
||||
DataOfDataDiriModel(
|
||||
idUser: json["id_user"],
|
||||
fullname: json["full_name"],
|
||||
headline: json["headline"],
|
||||
biography: json["biography"],
|
||||
datebirth: json["datebirth"],
|
||||
email: json["email"],
|
||||
phone: json["phone"],
|
||||
gender: json["jenis_kelamin"] == null
|
||||
? ''
|
||||
: json["jenis_kelamin"],
|
||||
socialLink: json["social_link"] == null
|
||||
? null
|
||||
: SocialLink.fromJson(json["social_link"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id_user": idUser,
|
||||
"full_name": fullname,
|
||||
"headline": headline,
|
||||
"biography": biography,
|
||||
"datebirth": datebirth,
|
||||
"email": email,
|
||||
"phone": phone,
|
||||
"jenis_kelamin": gender,
|
||||
"social_link": socialLink == null ? null : socialLink!.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class SocialLink {
|
||||
SocialLink({
|
||||
this.facebook,
|
||||
this.twitter,
|
||||
this.instagram,
|
||||
this.linkedin,
|
||||
});
|
||||
|
||||
String? facebook;
|
||||
String? twitter;
|
||||
String? instagram;
|
||||
String? linkedin;
|
||||
|
||||
factory SocialLink.fromJson(Map<String, dynamic> json) => SocialLink(
|
||||
facebook: json["facebook"],
|
||||
twitter: json["twitter"],
|
||||
instagram: json["instagram"],
|
||||
linkedin: json["linkedin"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"facebook": facebook,
|
||||
"twitter": twitter,
|
||||
"instagram": instagram,
|
||||
"linkedin": linkedin,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user