Entity.fromJson constructor

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

Implementation

factory Entity.fromJson(Map<String, dynamic> json) {
  return Entity(
    attributes: (json['Attributes'] as List?)
        ?.whereNotNull()
        .map((e) => Attribute.fromJson(e as Map<String, dynamic>))
        .toList(),
    beginOffset: json['BeginOffset'] as int?,
    category: (json['Category'] as String?)?.toEntityType(),
    endOffset: json['EndOffset'] as int?,
    id: json['Id'] as int?,
    score: json['Score'] as double?,
    text: json['Text'] as String?,
    traits: (json['Traits'] as List?)
        ?.whereNotNull()
        .map((e) => Trait.fromJson(e as Map<String, dynamic>))
        .toList(),
    type: (json['Type'] as String?)?.toEntitySubType(),
  );
}