import 'base.dart'; class Lookup extends Base { final int? id; // Now nullable final int? value;// Now nullable Lookup({this.id, this.value, String? name}) : super(identifier: id?.toString(), name: name); @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; // Use XOR for hash code combination Map toJson() { // Return a Map instead of calling a function return {"id": id, "name": name, "value": value}; } static Lookup? fromStatus(Lookup? old) { // Now accepts nullable Lookup and returns nullable Lookup if (old == null) return null; return Lookup( name: old.name,id: old.id, value: old.value, ); } // CreatedBy.fromJson(dynamic json) { // userId = json['userId'] ?? ''; // userName = json['userName'] ?? ''; // } Lookup.fromJson(Map? parsedJson) { // Now accepts nullable Map and returns nullable Lookup if (parsedJson == null) return null; return Lookup( name: parsedJson["name"], id: parsedJson["id"], value: parsedJson["value"], ); } }