import 'package:hive/hive.dart'; part 'shop_model.g.dart'; @HiveType(typeId: 0) class ShopModel { @HiveField(0) bool success; @HiveField(1) ShopDetails user; @HiveField(2) String token; @HiveField(3) String message; ShopModel({ required this.success, required this.user, required this.token, required this.message, }); factory ShopModel.fromJson(Map json) => ShopModel( success: json['success'], user: ShopDetails.fromJson(json['user']), token: json['token'], message: json['message'], ); Map toJson() => { 'success': success, 'user': user.toJson(), 'token': token, 'message': message, }; } @HiveType(typeId: 1) class ShopDetails { @HiveField(0) String id; @HiveField(1) String name; @HiveField(2) String email; @HiveField(3) String role; ShopDetails({ required this.id, required this.name, required this.email, required this.role, }); factory ShopDetails.fromJson(Map json) => ShopDetails( id: json['id'], name: json['name'], email: json['email'], role: json['role'], ); Map toJson() => { 'id': id, 'name': name, 'email': email, 'role': role, }; }