Project.fromJson constructor

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

Implementation

factory Project.fromJson(Map<String, Object?> json) {
  return Project(
    archived: json[r'archived'] as bool? ?? false,
    archivedBy: json[r'archivedBy'] != null
        ? User.fromJson(json[r'archivedBy']! as Map<String, Object?>)
        : null,
    archivedDate: DateTime.tryParse(json[r'archivedDate'] as String? ?? ''),
    assigneeType: json[r'assigneeType'] != null
        ? ProjectAssigneeType.fromValue(json[r'assigneeType']! as String)
        : null,
    avatarUrls: json[r'avatarUrls'] != null
        ? AvatarUrlsBean.fromJson(
            json[r'avatarUrls']! as Map<String, Object?>)
        : null,
    components: (json[r'components'] as List<Object?>?)
            ?.map((i) => ProjectComponent.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    deleted: json[r'deleted'] as bool? ?? false,
    deletedBy: json[r'deletedBy'] != null
        ? User.fromJson(json[r'deletedBy']! as Map<String, Object?>)
        : null,
    deletedDate: DateTime.tryParse(json[r'deletedDate'] as String? ?? ''),
    description: json[r'description'] as String?,
    email: json[r'email'] as String?,
    expand: json[r'expand'] as String?,
    favourite: json[r'favourite'] as bool? ?? false,
    id: json[r'id'] as String?,
    insight: json[r'insight'] != null
        ? ProjectInsight.fromJson(json[r'insight']! as Map<String, Object?>)
        : null,
    isPrivate: json[r'isPrivate'] as bool? ?? false,
    issueTypeHierarchy: json[r'issueTypeHierarchy'] != null
        ? Hierarchy.fromJson(
            json[r'issueTypeHierarchy']! as Map<String, Object?>)
        : null,
    issueTypes: (json[r'issueTypes'] as List<Object?>?)
            ?.map((i) => IssueTypeDetails.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    key: json[r'key'] as String?,
    landingPageInfo: json[r'landingPageInfo'] != null
        ? ProjectLandingPageInfo.fromJson(
            json[r'landingPageInfo']! as Map<String, Object?>)
        : null,
    lead: json[r'lead'] != null
        ? User.fromJson(json[r'lead']! as Map<String, Object?>)
        : null,
    name: json[r'name'] as String?,
    permissions: json[r'permissions'] != null
        ? ProjectPermissions.fromJson(
            json[r'permissions']! as Map<String, Object?>)
        : null,
    projectCategory: json[r'projectCategory'] != null
        ? ProjectCategory.fromJson(
            json[r'projectCategory']! as Map<String, Object?>)
        : null,
    projectTypeKey: json[r'projectTypeKey'] != null
        ? ProjectProjectTypeKey.fromValue(json[r'projectTypeKey']! as String)
        : null,
    properties: json[r'properties'] as Map<String, Object?>?,
    retentionTillDate:
        DateTime.tryParse(json[r'retentionTillDate'] as String? ?? ''),
    roles: json[r'roles'] as Map<String, Object?>?,
    self: json[r'self'] as String?,
    simplified: json[r'simplified'] as bool? ?? false,
    style: json[r'style'] != null
        ? ProjectStyle.fromValue(json[r'style']! as String)
        : null,
    url: json[r'url'] as String?,
    uuid: json[r'uuid'] as String?,
    versions: (json[r'versions'] as List<Object?>?)
            ?.map((i) =>
                Version.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
  );
}