TextBlock.fromJson constructor
TextBlock.fromJson(
- Map json
Returns an instance of TextBlock from a given json
.
Implementation
factory TextBlock.fromJson(Map<dynamic, dynamic> json) {
final text = json['text'];
final boundingBox = RectJson.fromJson(json['rect']);
final recognizedLanguages =
_listToRecognizedLanguages(json['recognizedLanguages']);
final cornerPoints = _listToCornerPoints(json['points']);
final lines = <TextLine>[];
for (final line in json['lines']) {
final textLine = TextLine.fromJson(line);
lines.add(textLine);
}
return TextBlock(
text: text,
lines: lines,
boundingBox: boundingBox,
recognizedLanguages: recognizedLanguages,
cornerPoints: cornerPoints,
);
}