getCount method
Future<int>
getCount({
- Filter where(
- TMeta t
- bool? useIsolate,
- Map<
String, dynamic> ? isolateArgs, - void onIsolatePreMap()?,
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;
}