40 lines
849 B
Dart
40 lines
849 B
Dart
class SubcategoryModel {
|
|
final int id;
|
|
final int category;
|
|
final String name;
|
|
|
|
final String createdDate;
|
|
final String icon1; // Added the missing icon1 field
|
|
|
|
SubcategoryModel({
|
|
required this.id,
|
|
required this.category,
|
|
required this.name,
|
|
|
|
required this.createdDate,
|
|
required this.icon1, // Added to constructor
|
|
});
|
|
|
|
factory SubcategoryModel.fromJson(Map<String, dynamic> json) {
|
|
return SubcategoryModel(
|
|
id: json['id'],
|
|
category: json['category'],
|
|
name: json['name'],
|
|
|
|
createdDate: json['created_date'],
|
|
icon1: json['icon1'], // Parse icon1 from JSON
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'category': category,
|
|
'name': name,
|
|
|
|
'created_date': createdDate,
|
|
'icon1': icon1, // Include icon1 in JSON output
|
|
};
|
|
}
|
|
}
|