You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
car_common_app/lib/models/provider_branches_models/profile/categroy.dart

85 lines
2.7 KiB
Dart

// 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<CategoryData>? data;
int? messageStatus;
String? message;
factory Category.fromJson(Map<String, dynamic> json) => Category(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<CategoryData>.from(json["data"].map((x) => CategoryData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.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<ServiceModel>? services;
factory CategoryData.fromJson(Map<String, dynamic> 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<String, dynamic> toJson() => {
"id": id == null ? null : id,
"categoryName": categoryName == null ? null : categoryName,
"categoryNameN": categoryNameN == null ? null : categoryNameN,
"serviceCategoryIconUrl": serviceCategoryIconUrl,
"serviceCategoryImageUrl": serviceCategoryImageUrl,
};
@override
List<Object> get props => [id ?? 0];
}