latest code merge changes
parent
c5c96a4fce
commit
534aab3ceb
@ -0,0 +1,67 @@
|
|||||||
|
class Lookup{
|
||||||
|
|
||||||
|
//old name label
|
||||||
|
final String name;
|
||||||
|
// old name key
|
||||||
|
final int value;
|
||||||
|
final int id;
|
||||||
|
|
||||||
|
const Lookup({
|
||||||
|
this.name,
|
||||||
|
this.value,
|
||||||
|
this.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator == (Object other) =>
|
||||||
|
identical(this, other) || other is Lookup &&
|
||||||
|
((value != null && value == other.value)
|
||||||
|
|| ( id != null && id == other.id )) ;
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => id?.hashCode ?? value?.hashCode;
|
||||||
|
|
||||||
|
toMap(){
|
||||||
|
return {
|
||||||
|
"id": id,
|
||||||
|
"name": name,
|
||||||
|
"value": value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Lookup.fromStatus(Lookup old){
|
||||||
|
if(old == null) return null;
|
||||||
|
return Lookup(
|
||||||
|
name: old.name,
|
||||||
|
id: old.id,
|
||||||
|
value: old.value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Lookup.fromJson(Map<String,dynamic> parsedJson){
|
||||||
|
if(parsedJson == null) return null;
|
||||||
|
return Lookup(
|
||||||
|
name: parsedJson["name"],
|
||||||
|
id: parsedJson["id"],
|
||||||
|
value: parsedJson["value"],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// factory Lookup.fromJson(Map<String,dynamic> parsedJson){
|
||||||
|
// if(parsedJson["id"] == null && parsedJson["uid"] == null) return null;
|
||||||
|
// return Lookup(
|
||||||
|
// name: parsedJson["value"],
|
||||||
|
// id: parsedJson["id"] is int
|
||||||
|
// ? parsedJson["id"]
|
||||||
|
// : int.tryParse(parsedJson["id"] ?? parsedJson["uid"]),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// factory Lookup.fromIntIdJson(Map<String,dynamic> parsedJson){
|
||||||
|
// return Lookup(
|
||||||
|
// name: parsedJson["value"],
|
||||||
|
// id: parsedJson["id"],
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue