class Customer { final int? id; final int? userId; final String name; final String? email; final String? phone; final String? address; final String? gstin; final String? idNumber; final int? stateId; final String? photoUrl; final DateTime? createdAt; // New fields final String? fatherName; final String? gender; final int? age; Customer({ this.id, this.userId, required this.name, this.email, this.phone, this.address, this.gstin, this.idNumber, this.stateId, this.photoUrl, this.createdAt, this.fatherName, this.gender, this.age, }); factory Customer.fromJson(Map json) { return Customer( id: json['id'], userId: json['userId'], name: json['name'], email: json['email'], phone: json['phone'], address: json['address'], gstin: json['gstin'], idNumber: json['idNumber'], stateId: json['stateId'], photoUrl: json['photoUrl'], fatherName: json['fatherName'], gender: json['gender'], age: json['age'], createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null, ); } Map toJson() { final Map data = {}; if (id != null) data['id'] = id; if (userId != null) data['userId'] = userId; data['name'] = name; if (email != null) data['email'] = email; if (phone != null) data['phone'] = phone; if (address != null) data['address'] = address; if (gstin != null) data['gstin'] = gstin; if (idNumber != null) data['idNumber'] = idNumber; if (stateId != null) data['stateId'] = stateId; if (photoUrl != null) data['photoUrl'] = photoUrl; if (fatherName != null) data['fatherName'] = fatherName; if (gender != null) data['gender'] = gender; if (age != null) data['age'] = age; return data; } }