count method
Implementation
@override
Future<int> count(
String table, {
String? where,
List<Object?>? whereArgs,
}) async {
try {
if (database == null) {
throw const DatabaseBridgeException(
error: 'Database is not initialized',
);
}
final result = await database!.rawQuery(
'SELECT COUNT(*) as count FROM $table${where != null ? ' WHERE $where' : ''}',
whereArgs,
);
return Sqflite.firstIntValue(result) ?? 0;
} catch (e) {
throw DatabaseBridgeException(error: e);
}
}