Words.fromJson constructor

Words.fromJson(
  1. Map json
)

Implementation

factory Words.fromJson(Map json) {
  List<ChineseWord> words;
  if (json['cw'] == null || json['cw'] is! List) {
    words = [];
  } else {
    words =
        (json['cw'] as List).cast<Map>().map(ChineseWord.fromJson).toList();
  }
  return Words(json['bg'] ?? 0, words);
}