// To parse this JSON data, do // // final itemModel = itemModelFromJson(jsonString); import 'dart:convert'; ItemModel itemModelFromJson(String str) => ItemModel.fromJson(json.decode(str)); String itemModelToJson(ItemModel data) => json.encode(data.toJson()); class ItemModel { final int? messageStatus; final int? totalItemsCount; final List? data; final String? message; ItemModel({ this.messageStatus, this.totalItemsCount, this.data, this.message, }); factory ItemModel.fromJson(Map json) => ItemModel( messageStatus: json["messageStatus"], totalItemsCount: json["totalItemsCount"], data: json["data"] == null ? [] : List.from(json["data"]!.map((x) => ItemData.fromJson(x))), message: json["message"], ); Map toJson() => { "messageStatus": messageStatus, "totalItemsCount": totalItemsCount, "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), "message": message, }; } class ItemData { final int? id; final String? name; final String? price; final String? manufactureDate; final String? description; final dynamic pictureUrl; final int? companyId; final int? serviceProviderServiceId; final String? serviceProviderServiceDescription; final bool? isActive; final bool? isAllowAppointment; final bool? isAppointmentCompanyLoc; final bool? isAppointmentCustomerLoc; final double? appointmentPricePercentage; bool? isUpdateOrSelected; ItemData({ this.id, this.name, this.price, this.manufactureDate, this.description, this.pictureUrl, this.companyId, this.serviceProviderServiceId, this.serviceProviderServiceDescription, this.isActive, this.isAllowAppointment, this.isAppointmentCompanyLoc, this.isAppointmentCustomerLoc, this.appointmentPricePercentage, this.isUpdateOrSelected, }); factory ItemData.fromJson(Map json) => ItemData( id: json["id"], name: json["name"], price: json["price"].toString(), manufactureDate: json["manufactureDate"], description: json["description"], pictureUrl: json["pictureUrl"], companyId: json["companyID"], serviceProviderServiceId: json["serviceProviderServiceID"], serviceProviderServiceDescription: json["serviceProviderServiceDescription"], isActive: json["isActive"], isAllowAppointment: json["isAllowAppointment"], isAppointmentCompanyLoc: json["isAppointmentCompanyLoc"], isAppointmentCustomerLoc: json["isAppointmentCustomerLoc"], isUpdateOrSelected: false, ); Map toJson() => { "id": id, "name": name, "price": price, "manufactureDate": manufactureDate, "description": description, "pictureUrl": pictureUrl, "companyID": companyId, "serviceProviderServiceID": serviceProviderServiceId, "isActive": isActive, "isAllowAppointment": isAllowAppointment, "isAppointmentCompanyLoc": isAppointmentCompanyLoc, "isAppointmentCustomerLoc": isAppointmentCustomerLoc, }; }