ObjectPreview.fromJson constructor

ObjectPreview.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory ObjectPreview.fromJson(Map<String, dynamic> json) {
  return ObjectPreview(
    type: ObjectPreviewType.fromJson(json['type'] as String),
    subtype:
        json.containsKey('subtype')
            ? ObjectPreviewSubtype.fromJson(json['subtype'] as String)
            : null,
    description:
        json.containsKey('description')
            ? json['description'] as String
            : null,
    overflow: json['overflow'] as bool? ?? false,
    properties:
        (json['properties'] as List)
            .map((e) => PropertyPreview.fromJson(e as Map<String, dynamic>))
            .toList(),
    entries:
        json.containsKey('entries')
            ? (json['entries'] as List)
                .map((e) => EntryPreview.fromJson(e as Map<String, dynamic>))
                .toList()
            : null,
  );
}