class Vendor { final int? id; final int? userId; final String name; final String? email; final String? phone; final String? address; final String? gstin; final int? stateId; final String? idNumber; final String? photoUrl; final String? contactPerson; final DateTime? createdAt; Vendor({ this.id, this.userId, required this.name, this.email, this.phone, this.address, this.gstin, this.stateId, this.idNumber, this.photoUrl, this.contactPerson, this.createdAt, }); factory Vendor.fromJson(Map json) { return Vendor( id: json['id'], userId: json['userId'], name: json['name'] ?? '', email: json['email'], phone: json['phone'], address: json['address'], gstin: json['gstin'], stateId: json['stateId'], idNumber: json['idNumber'], photoUrl: json['photoUrl'], contactPerson: json['contactPerson'], createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null, ); } Map toJson() { return { 'id': id, 'userId': userId, 'name': name, 'email': email, 'phone': phone, 'address': address, 'gstin': gstin, 'stateId': stateId, 'idNumber': idNumber, 'photoUrl': photoUrl, 'contactPerson': contactPerson, }; } Vendor copyWith({ int? id, int? userId, String? name, String? email, String? phone, String? address, String? gstin, int? stateId, String? idNumber, String? photoUrl, String? contactPerson, }) { return Vendor( id: id ?? this.id, userId: userId ?? this.userId, name: name ?? this.name, email: email ?? this.email, phone: phone ?? this.phone, address: address ?? this.address, gstin: gstin ?? this.gstin, stateId: stateId ?? this.stateId, idNumber: idNumber ?? this.idNumber, photoUrl: photoUrl ?? this.photoUrl, contactPerson: contactPerson ?? this.contactPerson, createdAt: createdAt, ); } }