import 'package:test_sa/models/lookup.dart'; class PPMCheckList{ Lookup status; String title; String comment; String measuredValue; PPMCheckList({ this.title, this.status, this.comment, this.measuredValue, }); Map toMap() { return { if(status != null) 'status': status?.id.toString(), if(title != null) 'title': title, if(comment != null) 'comment': comment, if(measuredValue != null) 'measuredValue': measuredValue, }; } factory PPMCheckList.fromMap(Map map) { return PPMCheckList( status: Lookup.fromJson(map['status']), title: map['title'] as String, comment: map['comment'] as String, measuredValue: map['measuredValue'] as String, ); } }