TextLine.fromJson constructor

TextLine.fromJson(
  1. Map json
)

Returns an instance of TextLine from a given json.

Implementation

factory TextLine.fromJson(Map<dynamic, dynamic> json) {
  final text = json['text'];
  final boundingBox = RectJson.fromJson(json['rect']);
  final confidence = json['confidence'];
  final angle = json['angle'];
  final recognizedLanguages =
      _listToRecognizedLanguages(json['recognizedLanguages']);
  final cornerPoints = _listToCornerPoints(json['points']);
  final elements = <TextElement>[];
  for (final element in json['elements']) {
    final textElement = TextElement.fromJson(element);
    elements.add(textElement);
  }
  return TextLine(
    text: text,
    elements: elements,
    boundingBox: boundingBox,
    recognizedLanguages: recognizedLanguages,
    cornerPoints: cornerPoints,
    confidence: confidence,
    angle: angle,
  );
}