SelectionEntity.fromJson constructor

SelectionEntity.fromJson(
  1. Map? map
)

Implementation

SelectionEntity.fromJson(Map<dynamic, dynamic>? map)
    : title = '',
      maxSelectedCount = SelectionConstant.maxSelectCount,
      isCustomTitleHighLight = false,
      isSelected = false,
      children = [],
      extMap = {} {
  if (map == null) return;
  title = map['title'] ?? '';
  subTitle = map['subTitle'] ?? '';
  key = map['key'] ?? '';
  type = map['type'] ?? '';
  defaultValue = map['defaultValue'] ?? '';
  value = map['value'] ?? '';
  if (map['maxSelectedCount'] != null &&
      int.tryParse(map['maxSelectedCount']) != null) {
    maxSelectedCount = int.tryParse(map['maxSelectedCount']) ??
        SelectionConstant.maxSelectCount;
  }
  extMap = map['ext'] ?? {};
  children = []
    ..addAll((map['children'] ?? []).map((o) => SelectionEntity.fromJson(o)));
  filterType = parserFilterTypeWithType(map['type'] ?? '');
  isSelected = false;
}