selectFirst method

Future<T?> selectFirst({
  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 the query.

Implementation

Future<T?> selectFirst(
    {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;
}