Project.fromJson constructor

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

Implementation

factory Project.fromJson(Map<String, dynamic> json) {
  return Project(
    id: json['id']?.toString() ?? '',
    name: json['name'] ?? '',
    type: json['type'],
    createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null,
    updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt']) : null,
    relations: json['relations'] != null
        ? List<ProjectRelation>.from(
            json['relations'].map((r) => ProjectRelation.fromJson(r)))
        : null,
  );
}