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.
88 lines
2.4 KiB
Dart
88 lines
2.4 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"],
|
|
data: json["data"] == null ? null : List<CategoryData>.from(json["data"].map((x) => CategoryData.fromJson(x))),
|
|
messageStatus: json["messageStatus"],
|
|
message: json["message"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"totalItemsCount": totalItemsCount,
|
|
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
|
|
"messageStatus": messageStatus,
|
|
"message": 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,
|
|
this.isDeactivated,
|
|
});
|
|
|
|
int? id;
|
|
String? categoryName;
|
|
String? categoryNameN;
|
|
String? serviceCategoryIconUrl;
|
|
String? serviceCategoryImageUrl;
|
|
String? branchId;
|
|
String? branchName;
|
|
bool? isDeactivated;
|
|
List<ServiceModel>? services;
|
|
|
|
factory CategoryData.fromJson(Map<String, dynamic> json) => CategoryData(
|
|
id: json["id"],
|
|
categoryName: json["categoryName"],
|
|
categoryNameN: json["categoryNameN"],
|
|
serviceCategoryIconUrl: json["serviceCategoryIconUrl"],
|
|
serviceCategoryImageUrl: json["serviceCategoryImageUrl"],
|
|
services: [],
|
|
isDeactivated: false,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"categoryName": categoryName,
|
|
"categoryNameN": categoryNameN,
|
|
"serviceCategoryIconUrl": serviceCategoryIconUrl,
|
|
"serviceCategoryImageUrl": serviceCategoryImageUrl,
|
|
};
|
|
|
|
@override
|
|
List<Object> get props => [id ?? 0];
|
|
}
|