fromMap static method

PickerEntity fromMap(
  1. Map<String, dynamic>? map
)

Implementation

static PickerEntity fromMap(Map<String, dynamic>? map) {
  if (map == null) return PickerEntity();
  PickerEntity entity = PickerEntity();
  entity.uniqueId = map['id'] ?? "";
  entity.name = map['name'] ?? "";
  entity.key = map['key'] ?? "";
  entity.type = map['type'] ?? "";
  entity.filterType = entity.parserFilterTypeWithType(map['type'] ?? "");
  entity.isSelected = map['isSelected'] ?? false;
  entity.defaultValue = map['defaultValue'] ?? "";
  entity.value = map['value'] ?? "";
  if (map['maxSelectedCount'] != null &&
      int.tryParse(map['maxSelectedCount']) != null) {
    entity.maxSelectedCount = int.tryParse(map['maxSelectedCount']) ??
        SelectionConstant.maxSelectCount;
  } else {
    entity.maxSelectedCount = SelectionConstant.maxSelectCount;
  }
  entity.extMap = map['ext'] ?? {};
//    entity.children = map['children'] ?? [];
  entity.children = []..addAll(
      (map['children'] as List? ?? []).map((o) => PickerEntity.fromMap(o)));
  return entity;
}