deserialize method

  1. @override
void deserialize(
  1. Map<String, dynamic>? json
)
override

Implementation

@override
void deserialize(Map<String, dynamic>? json) {
  if (json == null) {
    throw ApiException(400, 'Failed to deserialize Comment data model.');
  }

  super.deserialize(json);
  if (json.containsKey('Link')) {
    link = ModelBase.createInstance<WordsApiLink>(
        json['Link'] as Map<String, dynamic>);
  } else {
    link = null;
  }

  if (json.containsKey('RangeStart')) {
    rangeStart = ModelBase.createInstance<DocumentPosition>(
        json['RangeStart'] as Map<String, dynamic>);
  } else {
    rangeStart = null;
  }

  if (json.containsKey('RangeEnd')) {
    rangeEnd = ModelBase.createInstance<DocumentPosition>(
        json['RangeEnd'] as Map<String, dynamic>);
  } else {
    rangeEnd = null;
  }

  if (json.containsKey('Author')) {
    author = json['Author'] as String;
  } else {
    author = null;
  }

  if (json.containsKey('Initial')) {
    initial = json['Initial'] as String;
  } else {
    initial = null;
  }

  if (json.containsKey('DateTime')) {
    dateTime = DateTime.parse(json['DateTime'] as String);
  } else {
    dateTime = null;
  }

  if (json.containsKey('Text')) {
    text = json['Text'] as String;
  } else {
    text = null;
  }

  if (json.containsKey('Content')) {
    content = ModelBase.createInstance<StoryChildNodes>(
        json['Content'] as Map<String, dynamic>);
  } else {
    content = null;
  }
}