selectFirstWhere method

Future<T?> selectFirstWhere(
  1. ConditionQuery where(
    1. T model
    ), {
  2. List<FieldOrder> orderBy(
    1. T model
    )?,
  3. int? offset,
  4. List<FieldWithValue> desiredFields(
    1. T model
    )?,
})

Get first entry matching where.

Implementation

Future<T?> selectFirstWhere(ConditionQuery Function(T model) where,
    {List<FieldOrder> Function(T model)? orderBy,
    int? offset,
    List<FieldWithValue> Function(T model)? desiredFields}) async {
  var result = (await select(
      where: where, orderBy: orderBy, limit: 1, offset: offset));
  return result.isNotEmpty ? result.first : null;
}