DocumentSection.fromMap constructor

DocumentSection.fromMap(
  1. Map map
)

Implementation

factory DocumentSection.fromMap(Map<dynamic, dynamic> map) {
  final List<DocumentWord> words = <DocumentWord>[];
  final List<DocumentLine> lines = <DocumentLine>[];
  final List<MLTextLanguage> languages = <MLTextLanguage>[];

  if (map['wordList'] != null) {
    map['wordList'].forEach((dynamic v) {
      words.add(DocumentWord.fromMap(v));
    });
  }
  if (map['lineList'] != null) {
    map['lineList'].forEach((dynamic v) {
      lines.add(DocumentLine.fromMap(v));
    });
  }
  if (map['languageList'] != null) {
    map['languageList'].forEach((dynamic v) {
      languages.add(MLTextLanguage.fromJson(v));
    });
  }
  return DocumentSection(
    border: map['border'] != null ? TextBorder.fromMap(map['border']) : null,
    stringValue: map['stringValue'],
    wordList: words,
    lineList: lines,
    interval:
        map['interval'] != null ? Interval.fromMap(map['interval']) : null,
    languageList: languages,
    possibility: map['possibility'],
  );
}