Block.fromJson constructor

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

Implementation

factory Block.fromJson(Map<String, dynamic> json) {
  return Block(
    blockType: (json['BlockType'] as String?)?.toBlockType(),
    columnIndex: json['ColumnIndex'] as int?,
    columnSpan: json['ColumnSpan'] as int?,
    confidence: json['Confidence'] as double?,
    entityTypes: (json['EntityTypes'] as List?)
        ?.whereNotNull()
        .map((e) => (e as String).toEntityType())
        .toList(),
    geometry: json['Geometry'] != null
        ? Geometry.fromJson(json['Geometry'] as Map<String, dynamic>)
        : null,
    id: json['Id'] as String?,
    page: json['Page'] as int?,
    relationships: (json['Relationships'] as List?)
        ?.whereNotNull()
        .map((e) => Relationship.fromJson(e as Map<String, dynamic>))
        .toList(),
    rowIndex: json['RowIndex'] as int?,
    rowSpan: json['RowSpan'] as int?,
    selectionStatus:
        (json['SelectionStatus'] as String?)?.toSelectionStatus(),
    text: json['Text'] as String?,
    textType: (json['TextType'] as String?)?.toTextType(),
  );
}