DataSetSection.fromJson constructor

DataSetSection.fromJson(
  1. Map<String, dynamic> jsonData
)

Implementation

factory DataSetSection.fromJson(Map<String, dynamic> jsonData) {
  return DataSetSection(
      id: jsonData['id'],
      dirty: jsonData['dirty'],
      created: jsonData['created'],
      lastUpdated: jsonData['lastUpdated'],
      name: jsonData['name'],
      displayName: jsonData['displayName'],
      showRowTotals: jsonData['showRowTotals'],
      sortOrder: jsonData['sortOrder'],
      dataSet: jsonData['dataSet'],
      dataElements: List<dynamic>.from(jsonData['dataElements'] ?? [])
          .map((dataElement) => DataSetSectionDataElement.fromJson({
                ...dataElement,
                'dataElement': dataElement['dataElement'],
                'dataSetSection': jsonData['id'],
                'dirty': false
              }))
          .toList(),
      greyedFields: List<dynamic>.from(jsonData['greyedFields'] ?? [])
          .map((greyedField) => DataSetSectionGreyedField.fromJson({
                ...greyedField,
                'dataSetSection': jsonData['id'],
                'dirty': false
              }))
          .toList());
}