toJson method
Implementation
Map<String, dynamic> toJson(){
final fieldMap = _fieldMap();
final json = toMap();
for(String key in json.keys){
final val = json[key];
if(val is DateTime){
final field = fieldMap[key];
if(field!.additionalFormat != null){
json[key] = dateToString(val, format: field.additionalFormat);
}
else {
json[key] = dateToString(val);
}
}
if(val is NUIEnt){
json[key] = val.toJson();
}
if(val is List<NUIEnt>){
final mapList = <Map<String, dynamic>>[];
for(NUIEnt e in val){
mapList.add(e.toJson());
}
json[key] = mapList;
}
}
return json;
}