54 lines
1016 B
Dart
54 lines
1016 B
Dart
import 'package:hive/hive.dart';
|
|
|
|
part 'shop_model.g.dart';
|
|
|
|
@HiveType(typeId: 1)
|
|
class ShopModel {
|
|
@HiveField(0)
|
|
final String id;
|
|
|
|
@HiveField(1)
|
|
final String image;
|
|
|
|
@HiveField(2)
|
|
final String mobile;
|
|
|
|
@HiveField(3)
|
|
final String email;
|
|
|
|
@HiveField(4)
|
|
final String shopName;
|
|
|
|
@HiveField(5)
|
|
final String address; // ✅ NEW
|
|
|
|
ShopModel({
|
|
required this.id,
|
|
required this.image,
|
|
required this.mobile,
|
|
required this.email,
|
|
required this.shopName,
|
|
required this.address,
|
|
});
|
|
|
|
factory ShopModel.fromJson(Map<String, dynamic> json) {
|
|
return ShopModel(
|
|
id: json['id'] ?? '',
|
|
image: json['image'] ?? '',
|
|
mobile: json['mobile'] ?? '',
|
|
email: json['email'] ?? '',
|
|
shopName: json['shopName'] ?? '',
|
|
address: json['address'] ?? '', // ✅ NEW
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'image': image,
|
|
'mobile': mobile,
|
|
'email': email,
|
|
'shopName': shopName,
|
|
'address': address, // ✅ NEW
|
|
};
|
|
}
|