queryRowCount method

Future<int> queryRowCount(
  1. dynamic dbName
)

Implementation

Future<int> queryRowCount(dbName) async {
  Directory documentsDirectory = await getApplicationDocumentsDirectory();
  String path = join(documentsDirectory.path, "$dbName.db");
  Database _database = await openDatabase(path, version: _databaseVersion);
  Database db = _database;
  try {
    var count = Sqflite.firstIntValue(
        await db.rawQuery('SELECT COUNT(*) FROM ${dbName}1'));
    print("number of raws is: $count");
    return count!;
  } catch (exception) {
    print('there are no rows created');
    throw Exception(exception.toString());
  }
}