OcrElement.fromJson constructor

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

Implementation

factory OcrElement.fromJson(Map<String, dynamic> json) {
  String _type = json["_type"];
  switch (_type) {
    case "Glyph":
      return Glyph.fromJson(json);
    case "Word":
      return Word.fromJson(json);
    case "Line":
      return Line.fromJson(json);
    case "Block":
      return Block.fromJson(json);
    case "Page":
      return OcrPage.fromJson(json);
    default:
      throw ArgumentError("Invalid polymorphic type: $_type");
  }
}