48 lines
953 B
Dart
48 lines
953 B
Dart
class CategoriesModel {
|
|
final int id;
|
|
final String name;
|
|
// Icon filename
|
|
final String iconUrl; // Full icon URL
|
|
// Image filename
|
|
final String imageUrl; // Full image URL
|
|
final String createdDate;
|
|
|
|
CategoriesModel({
|
|
required this.id,
|
|
required this.name,
|
|
|
|
required this.iconUrl,
|
|
|
|
required this.imageUrl,
|
|
required this.createdDate,
|
|
});
|
|
|
|
factory CategoriesModel.fromJson(Map<String, dynamic> json) {
|
|
return CategoriesModel(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
|
|
iconUrl: json['icon1'] ?? '',
|
|
|
|
imageUrl: json['image1'] ?? '',
|
|
createdDate: json['created_date'] ?? '',
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
|
|
'icon1': iconUrl,
|
|
|
|
'image1': imageUrl,
|
|
'created_date': createdDate,
|
|
};
|
|
}
|
|
|
|
// Convenience getters to access the image URLs
|
|
String getIconUrl() => iconUrl;
|
|
String getImageUrl() => imageUrl;
|
|
}
|