provinces property

dynamic get provinces

Implementation

get provinces {
  List<Point> provList = [];
  List<String> keys = metaInfo.keys.toList();
  for (int i = 0; i < keys.length; i++) {
    String name = metaInfo[keys[i]]!;
    provList.add(Point(
        code: keys[i],
        children: [],
        letter: PinyinHelper.getFirstWordPinyin(name).substring(0, 1),
        name: name));
  }
  if (this.sort == true) {
    provList.sort((Point a, Point b) {
      if (a.letter == null && b.letter == null) {
        return 0;
      }

      if (a.letter == null) {
        return 1;
      }

      return a.letter!.compareTo(b.letter!);
    });
  }

  return provList;
}