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/comment.dart

82 lines
1.7 KiB
Dart

class Comment {
Comment({
this.id,
this.callRequestId,
this.createdOn,
this.createdBy,
this.comment,
});
Comment.fromJson(dynamic json) {
id = json['id'];
callRequestId = json['callRequestId'];
createdOn = json['createdOn'] ?? '';
createdBy = json['createdBy'] != null ? CreatedBy.fromJson(json['createdBy']) : null;
comment = json['comment'] ?? '';
}
num? id;
num? callRequestId;
String? createdOn;
CreatedBy? createdBy;
String? comment;
Comment copyWith({
num? id,
num? callRequestId,
String? createdOn,
CreatedBy? createdBy,
String? comment,
}) =>
Comment(
id: id ?? this.id,
callRequestId: callRequestId ?? this.callRequestId,
createdOn: createdOn ?? this.createdOn,
createdBy: createdBy ?? this.createdBy,
comment: comment ?? this.comment,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['callRequestId'] = callRequestId;
map['createdOn'] = createdOn;
if (createdBy != null) {
map['createdBy'] = createdBy?.toJson();
}
map['comment'] = comment;
return map;
}
}
class CreatedBy {
CreatedBy({
this.userId,
this.userName,
});
CreatedBy.fromJson(dynamic json) {
userId = json['userId'] ?? '';
userName = json['userName'] ?? '';
}
String? userId;
String? userName;
CreatedBy copyWith({
String? userId,
String? userName,
}) =>
CreatedBy(
userId: userId ?? this.userId,
userName: userName ?? this.userName,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['userId'] = userId;
map['userName'] = userName;
return map;
}
}