firstWhereOrNull method

  1. @override
Future<TEntity?> firstWhereOrNull({
  1. Iterable<ColumnDefinition<IEntity, dynamic>>? columns(
    1. TMeta t
    )?,
  2. List<OrmOrder>? orderBy(
    1. TMeta t
    )?,
  3. required Filter where(
    1. TMeta t
    ),
  4. int? offset,
  5. bool? useIsolate,
  6. Map<String, dynamic>? isolateArgs,
  7. void onIsolatePreMap(
    1. Map<String, dynamic>? isolateArgs
    )?,
})
inherited

Implementation

@override
Future<TEntity?> firstWhereOrNull({
  Iterable<ColumnDefinition>? Function(TMeta t)? columns,
  List<OrmOrder>? Function(TMeta t)? orderBy,
  required Filter Function(TMeta t) where,
  int? offset,
  final bool? useIsolate,
  Map<String, dynamic>? isolateArgs,
  void Function(Map<String, dynamic>? isolateArgs)? onIsolatePreMap,
}) async {
  List<TEntity> maps = await query(
    where: where,
    columns: columns ?? (t) => t.columns,
    limit: 1,
    offset: offset,
    orderBy: orderBy,
    useIsolate: useIsolate,
    isolateArgs: isolateArgs,
    onIsolatePreMap: onIsolatePreMap,
  );
  if (maps.isNotEmpty) {
    return maps.first;
  }
  return null;
}