How do I get the row count of a database table in Flutter. I am using the SQFlite plugin.
I assume that it is similar to Android, but Android has DatabaseUtils.queryNumEntries(db, TABLE_NAME)
. Does SQFlite have something similar?
I am answering the question to the best of my knowledge below, but I would be glad for a better answer if there is one.
Future<int> getCount() async => firstIntValue(await (await db).query(tableName, columns: ['COUNT(*)'])) ?? 0;
β Degraded