getCount method

Future<int> getCount(
  1. String work
)

Returns the number of barcodes for that work.

Implementation

Future<int> getCount(String work) async {
  final List<Map<String, dynamic>> queryResults = await localDatabase.database
      .query(
        _table,
        columns: <String>['count(1) as my_count'],
        where: '$_columnWork = ?',
        whereArgs: <String>[work],
      );
  for (final Map<String, dynamic> row in queryResults) {
    return row['my_count'] as int;
  }
  throw Exception('Cannot count table $_table for work $work');
}