Count how many records the database has? #1028
ReinaldoSergio
started this conversation in
General
Replies: 1 comment
-
You could use this method in a database: Future<int> countAllRecords() async {
var count = 0;
for (final table in allTables) {
final countTable = countAll();
final row = await (selectOnly(table)..addColumns([countTable])).getSingle();
count += row.read(countTable);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using moor_flutter and I don't know how to count how many records there are in the database, can someone tell me how to do this?
Beta Was this translation helpful? Give feedback.
All reactions