Perbarui konfigurasi routing setelah penghapusan modul dashboard dan home
- Sesuaikan konfigurasi routing aplikasi - Hapus referensi ke modul dashboard dan home yang sudah tidak digunakan - Bersihkan binding dan impor yang tidak perlu - menambahkan model-model
This commit is contained in:
52
lib/app/data/models/donatur_model.dart
Normal file
52
lib/app/data/models/donatur_model.dart
Normal file
@ -0,0 +1,52 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class DonaturModel {
|
||||
final String id;
|
||||
final String nama;
|
||||
final String? alamat;
|
||||
final String? noTelp;
|
||||
final String? email;
|
||||
final String? jenisDonatur; // Individu, Organisasi, Perusahaan, dll
|
||||
final DateTime createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
DonaturModel({
|
||||
required this.id,
|
||||
required this.nama,
|
||||
this.alamat,
|
||||
this.noTelp,
|
||||
this.email,
|
||||
this.jenisDonatur,
|
||||
required this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory DonaturModel.fromRawJson(String str) =>
|
||||
DonaturModel.fromJson(json.decode(str));
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory DonaturModel.fromJson(Map<String, dynamic> json) => DonaturModel(
|
||||
id: json["id"],
|
||||
nama: json["nama"],
|
||||
alamat: json["alamat"],
|
||||
noTelp: json["no_telp"],
|
||||
email: json["email"],
|
||||
jenisDonatur: json["jenis_donatur"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: json["updated_at"] == null
|
||||
? null
|
||||
: DateTime.parse(json["updated_at"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"nama": nama,
|
||||
"alamat": alamat,
|
||||
"no_telp": noTelp,
|
||||
"email": email,
|
||||
"jenis_donatur": jenisDonatur,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user