getCurrentSelectionEntityParams method

Map<String, List<PickerEntity>> getCurrentSelectionEntityParams(
  1. PickerEntity selectionEntity, {
  2. bool includeUnlimitSelection = false,
})

Implementation

Map<String, List<PickerEntity>> getCurrentSelectionEntityParams(
    PickerEntity selectionEntity,
    {bool includeUnlimitSelection = false}) {
  Map<String, List<PickerEntity>> params = Map();
  String parentKey = selectionEntity.key ?? '';
  var selectedEntity = selectionEntity.children
      .where((PickerEntity f) => f.isSelected)
      .where((PickerEntity f) {
        if (includeUnlimitSelection) {
          return true;
        } else {
          return !PhoenixTools.isEmpty(f.value);
        }
      })
      .map((PickerEntity f) => f)
      .toList();
  List<PickerEntity> selectedParams = selectedEntity;
  if (!PhoenixTools.isEmpty(selectedParams) &&
      !PhoenixTools.isEmpty(parentKey)) {
    params[parentKey] = selectedParams;
  }
  return params;
}