You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/models/ppm/ppm_attachment.dart

40 lines
1.0 KiB
Dart

class PpmAttachments {
PpmAttachments({
this.id,
this.visitId,
this.attachmentName,
this.attachmentURL,
});
PpmAttachments.fromJson(dynamic json) {
id = json['id'];
visitId = json['visitId'];
attachmentName = json['attachmentName'] ?? json['attachmentURL']; // Handle potential null and prioritize'attachmentName'
}
num? id; // Now nullable
num? visitId; // Now nullable
String? attachmentName; // Now nullable
String? attachmentURL; // Now nullable
PpmAttachments copyWith({
num? id,
num? visitId,
String? attachmentName,
String? attachmentURL,
}) =>
PpmAttachments(
id: id ?? this.id,
visitId: visitId ?? this.visitId,
attachmentName: attachmentName ?? this.attachmentName,attachmentURL: attachmentURL ?? this.attachmentURL,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['visitId'] = visitId;
map['attachmentName'] = attachmentName;
map['attachmentURL'] = attachmentURL;
return map;
}
}