makeResolver4<AggregateT> function

ResolveProperty<AggregateT> makeResolver4<AggregateT>(
  1. AggregateT? first,
  2. AggregateT? second,
  3. AggregateT? third,
  4. AggregateT fourth,
)

Implementation

ResolveProperty<AggregateT> makeResolver4<AggregateT>(AggregateT? first, AggregateT? second, AggregateT? third, AggregateT fourth) {
  if (first == null && second == null && third == null)
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(fourth);
  else if (first == null && second == null)
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(third!) ?? getProperty(fourth);
  else if (second == null && third == null)
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(first!) ?? getProperty(fourth);
  else if (first == null && third == null)
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(second!) ?? getProperty(fourth);
  else if (first == null)
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(second!) ?? getProperty(third!) ?? getProperty(fourth);
  else if (second == null)
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(first) ?? getProperty(third!) ?? getProperty(fourth);
  else if (third == null)
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(first) ?? getProperty(second) ?? getProperty(fourth);
  else
    return <FieldT>(GetProperty<FieldT, AggregateT> getProperty) => getProperty(first) ?? getProperty(second) ?? getProperty(third) ?? getProperty(fourth);
}