searchOptional method

StructureModel? searchOptional(
  1. Iterable<StructureModel> items,
  2. String compareTo
)

Implementation

StructureModel? searchOptional(
    Iterable<StructureModel> items, String compareTo) {
  final response = items.optionalSingle<StructureModel>(
    (element) => element.folder == compareTo,
  );

  if (response == null) {
    throw FlowException(
      'La carpeta $compareTo no existe dentro de la estructura del modelo',
    );
  }

  return response;
}