class MostPopularModel { final int id; final int vendorId; final int serviceType; final String vendorName; final String? vendorNameAlt; final String serviceName; final int category; final int subcategory; final String workingHours; final String workingDuration; final String amount; final String location; final String description; final String details; final List? images1; // ✅ updated from String? to List? final String? videos; final String createdDate; final String? profilePic1; // ✅ new field final double? averageReview; final String phoneNumber; MostPopularModel({ required this.id, required this.vendorId, required this.serviceType, required this.vendorName, this.vendorNameAlt, required this.serviceName, required this.category, required this.subcategory, required this.workingHours, required this.workingDuration, required this.amount, required this.location, required this.description, required this.details, this.images1, this.videos, required this.createdDate, this.profilePic1, // ✅ new field this.averageReview, required this.phoneNumber, }); factory MostPopularModel.fromJson(Map json) { return MostPopularModel( id: json['id'] ?? 0, vendorId: json['vendor_id'] ?? 0, serviceType: json['service_type'] ?? 0, vendorName: json['vendorname'] ?? '', vendorNameAlt: json['vendor_name'], serviceName: json['servicename'] ?? '', category: json['category'] ?? 0, subcategory: json['subcategory'] ?? 0, workingHours: json['workinghours'] ?? '', workingDuration: json['workingduration'] ?? '', amount: json['amount']?.toString() ?? '', location: json['location'] ?? '', description: json['description'] ?? '', details: json['details'] ?? '', images1: (json['images1'] != null) ? List.from(json['images1']) : null, videos: json['videos'], createdDate: json['created_date'] ?? '', profilePic1: json['profile_pic1'], // ✅ new field averageReview: json['average_review'] != null ? (json['average_review'] is double) ? json['average_review'] : double.tryParse(json['average_review'].toString()) : null, phoneNumber: json['phone_number'] ?? '', ); } Map toJson() { return { 'id': id, 'vendor_id': vendorId, 'service_type': serviceType, 'vendorname': vendorName, 'vendor_name': vendorNameAlt, 'servicename': serviceName, 'category': category, 'subcategory': subcategory, 'workinghours': workingHours, 'workingduration': workingDuration, 'amount': amount, 'location': location, 'description': description, 'details': details, 'images1': images1, 'videos': videos, 'created_date': createdDate, 'profile_pic1': profilePic1, // ✅ new field 'average_review': averageReview, 'phone_number': phoneNumber, }; } }