ReportModel.fromJson constructor

ReportModel.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory ReportModel.fromJson(Map<String, dynamic> json) {
  UserModel user = UserModel.fromJson(json["user"]);
  PostModel post = PostModel.fromJson(json["post"]);
  ReportSubTypeModel? type =
      json["type"] != null ? ReportSubTypeModel.fromJson(json["type"]) : null;
  return new ReportModel(
    id: json['id'],
    type: type,
    post: post,
    user: user,
    createdAt: DateTime.parse(json['createdAt'] as String),
  );
}