fromJson method Null safety

dynamic fromJson(
  1. Map<String, dynamic> objectData
)

Implementation

dynamic fromJson(Map<String, dynamic> objectData) {
  objectData.forEach((String key, dynamic value) {
    if (key == parseClassName || key == '__type') {
      // NO OP
    } else if (key == keyVarObjectId) {
      _getObjectData()[keyVarObjectId] = value;
    } else if (key == keyVarCreatedAt) {
      if (keyVarCreatedAt is String) {
        _getObjectData()[keyVarCreatedAt] = _parseDateFormat.parse(value);
      } else {
        _getObjectData()[keyVarCreatedAt] = value;
      }
    } else if (key == keyVarUpdatedAt) {
      if (keyVarUpdatedAt is String) {
        _getObjectData()[keyVarUpdatedAt] = _parseDateFormat.parse(value);
      } else {
        _getObjectData()[keyVarUpdatedAt] = _parseDateFormat.parse(value);
      }
    } else if (key == keyVarAcl) {
      _getObjectData()[keyVarAcl] = ParseACL().fromJson(value);
    } else {
      _getObjectData()[key] = parseDecode(value);
    }
  });

  return this;
}