import '../lookup.dart'; class Contact { Lookup? title; Lookup? contactPerson; String? job; String? email; String? telephone; String? landLine; Contact( {this.title, this.contactPerson, this.job, this.email, this.telephone, this.landLine}); Map toMap() { return { if (title != null) 'title': title!.id.toString(), if (contactPerson != null) 'contactPerson': contactPerson!.id.toString(), if (job != null) 'job': job!, if (email != null) 'email': email!, if (telephone != null) 'telephone': telephone!, if (landLine != null) 'landLine': landLine!, }; } factory Contact.fromMap(Map map) { return Contact( title: map['title'] as Lookup, contactPerson: map['contactPerson'] as Lookup, job: map['job'] as String, email: map['email'] as String, telephone: map['telephone'] as String, landLine: map['landLine'] as String, ); } }