MicroSiteCompetencyItemDataModel.fromJson constructor

MicroSiteCompetencyItemDataModel.fromJson(
  1. Map<String, dynamic> json, {
  2. bool useCompetencyv6 = false,
})

Implementation

factory MicroSiteCompetencyItemDataModel.fromJson(Map<String, dynamic> json,
    {bool useCompetencyv6 = false}) {
  List<MicroSiteCompetencyItemDataModel>? childrenList;
  if (json['children'] != null) {
    childrenList = <MicroSiteCompetencyItemDataModel>[];
    json['children'].forEach((v) {
      childrenList!.add(MicroSiteCompetencyItemDataModel.fromJson(v,
          useCompetencyv6: useCompetencyv6));
    });
  }
  return useCompetencyv6
      ? MicroSiteCompetencyItemDataModel(
          id: json['identifier'],
          type: getType(json['identifier']),
          name: json['name'],
          displayName: json['displayName'],
          description: json['description'],
          status: json['status'],
          count: json['count'].toString(),
          children: childrenList,
        )
      : MicroSiteCompetencyItemDataModel(
          id: json['id'].toString(),
          type: json['type'],
          name: json['name'],
          displayName: json['name'],
          description: json['description'],
          status: json['status'],
          count: json['count'].toString(),
          children: childrenList,
        );
}