countFromResults static method
The count of a COUNT query's results: the first row's parseable
count column, or 0 without one (no row, as the SQLite and MySQL
adapters; a .first used to throw a StateError here).
Implementation
@visibleForTesting
static int countFromResults(Iterable<Map<String, dynamic>> results) =>
results
.map((row) {
var count = row['count'] ?? 0;
return count is int ? count : int.tryParse(count.toString().trim());
})
.whereType<int>()
.firstOrNull ??
0;