// To parse this JSON data, do // // final category = categoryFromJson(jsonString); import 'dart:convert'; import 'package:equatable/equatable.dart'; import 'package:mc_common_app/models/provider_branches_models/provider_profile_model.dart'; import 'package:mc_common_app/models/services_models/service_model.dart'; Category categoryFromJson(String str) => Category.fromJson(json.decode(str)); String categoryToJson(Category data) => json.encode(data.toJson()); class Category { Category({ this.totalItemsCount, this.data, this.messageStatus, this.message, }); int? totalItemsCount; List? data; int? messageStatus; String? message; factory Category.fromJson(Map json) => Category( totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"], data: json["data"] == null ? null : List.from(json["data"].map((x) => CategoryData.fromJson(x))), messageStatus: json["messageStatus"] == null ? null : json["messageStatus"], message: json["message"] == null ? null : json["message"], ); Map toJson() => { "totalItemsCount": totalItemsCount == null ? null : totalItemsCount, "data": data == null ? null : List.from(data!.map((x) => x.toJson())), "messageStatus": messageStatus == null ? null : messageStatus, "message": message == null ? null : message, }; } // ignore: must_be_immutable class CategoryData extends Equatable { CategoryData({ this.id, this.categoryName, this.categoryNameN, this.serviceCategoryIconUrl, this.serviceCategoryImageUrl, this.services, this.branchId, this.branchName, }); int? id; String? categoryName; String? categoryNameN; dynamic? serviceCategoryIconUrl; dynamic? serviceCategoryImageUrl; String? branchId; String? branchName; List? services; factory CategoryData.fromJson(Map json) => CategoryData( id: json["id"] == null ? null : json["id"], categoryName: json["categoryName"] == null ? null : json["categoryName"], categoryNameN: json["categoryNameN"] == null ? null : json["categoryNameN"], serviceCategoryIconUrl: json["serviceCategoryIconUrl"], serviceCategoryImageUrl: json["serviceCategoryImageUrl"], services: [], ); Map toJson() => { "id": id == null ? null : id, "categoryName": categoryName == null ? null : categoryName, "categoryNameN": categoryNameN == null ? null : categoryNameN, "serviceCategoryIconUrl": serviceCategoryIconUrl, "serviceCategoryImageUrl": serviceCategoryImageUrl, }; @override List get props => [id ?? 0]; }