count<T extends Model> static method

Future<int> count<T extends Model>()

Counts total records.

Implementation

static Future<int> count<T extends Model>() async {
  try {
    final result = await _database.rawQuery(
      'SELECT COUNT(*) as count FROM ${_getTableName<T>()}',
    );
    return result.first['count'] as int? ?? 0;
  } catch (e) {
    return 0;
  }
}