TextLine.fromMap constructor

TextLine.fromMap(
  1. Map map
)

Implementation

factory TextLine.fromMap(Map<dynamic, dynamic> map) {
  final List<TextWord> words = <TextWord>[];
  final List<MLPoint> vertexes = <MLPoint>[];
  final List<MLTextLanguage> languages = <MLTextLanguage>[];

  if (map['words'] != null) {
    map['words'].forEach((dynamic v) {
      words.add(TextWord.fromMap(v));
    });
  }
  if (map['vertexes'] != null) {
    map['vertexes'].forEach((dynamic v) {
      vertexes.add(MLPoint.fromJson(v));
    });
  }
  if (map['languageList'] != null) {
    map['languageList'].forEach((dynamic v) {
      languages.add(MLTextLanguage.fromJson(v));
    });
  }
  return TextLine(
    border: map['border'] != null ? TextBorder.fromMap(map['border']) : null,
    stringValue: map['stringValue'],
    isVertical: map['isVertical'],
    rotationDegree: map['rotationDegree'],
    words: words,
    vertexes: vertexes,
    languageList: languages,
    language: map['language'],
    possibility: map['possibility'],
  );
}