You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.5 KiB

import 'package:hive/hive.dart';
@HiveType(typeId: 0)
class PhoneNumberHive{
@HiveField(0)
int? id;
@HiveField(1)
String? title;
@HiveField(2)
String? time;
@HiveField(3)
bool? state;
@HiveField(4)
List<PhoneNumModel>? phoneList;
PhoneNumberHive({
this.id,
this.title,
this.time,
this.state,
this.phoneList,
});
PhoneNumberHive.fromJson(Map<String,dynamic> json){
id=json['id'];
title=json['title'];
time=json['time'];
state=json['state'];
if(json['phoneList'] !=null){
phoneList=json['phoneList'].map((e) => PhoneNumModel.from(e)).toList();
}else{
phoneList=[];
}
}
Map<String,dynamic> toJson(){
final Map<String,dynamic> data= <String,dynamic>{};
data['id'] =id;
data['title']=title;
data['time']=time;
data['state']=state;
if(phoneList!=null){
data['phoneList']=phoneList!.map((e) => e.toJson()).toList();
}
return data;
}
}
@HiveType(typeId: 1)
class PhoneNumModel{
@HiveField(0)
int? id;
@HiveField(1)
String? name;
@HiveField(2)
String? phone;
@HiveField(3)
bool? state;
PhoneNumModel({
this.id,
this.name,
this.phone,
this.state,
});
PhoneNumModel.from(Map<String,dynamic> json){
id=json['id'];
name=json['name'];
phone=json['phone'];
state=json['state'];
}
Map<String,dynamic> toJson(){
final Map<String,dynamic> data=<String,dynamic>{};
data["id"]=id;
data['name']=name;
data['phone']=phone;
data['state']=state;
return data;
}
}