getCount method

  1. @override
Future<int> getCount({
  1. Filter where(
    1. TMeta t
    )?,
  2. bool? useIsolate,
  3. Map<String, dynamic>? isolateArgs,
  4. void onIsolatePreMap(
    1. Map<String, dynamic>? isolateArgs
    )?,
})
inherited

Implementation

@override
Future<int> getCount({
  Filter Function(TMeta t)? where,
  final bool? useIsolate,
  Map<String, dynamic>? isolateArgs,
  void Function(Map<String, dynamic>? isolateArgs)? onIsolatePreMap,
}) async {
  List<Map<String, Object?>> result = await rawQuery(
    where,
    'SELECT COUNT (*) FROM ${t.tableName}',
    useIsolate: useIsolate,
    isolateArgs: isolateArgs,
    onIsolatePreMap: onIsolatePreMap,
  );
  if (result.isNotEmpty) {
    final firstRow = result.first;
    if (firstRow.isNotEmpty) {
      return parseInt(firstRow.values.first) ?? 0;
    }
  }
  return 0;
}