count method

Future<int> count(
  1. ISQLiteItem item
)

Implementation

Future<int> count(ISQLiteItem item) async {
  var db = await getOpenDatabase();
  var exist = await tableExists(item.getTableName());
  if (!exist) {
    return 0; // If the table doesn't exist, return false
  }
  var count =
      await db.rawQuery('SELECT COUNT(*) FROM ${item.getTableName()}');
  var total = Sqflite.firstIntValue(count) ?? 0;
  return total;
}