getAColumnFrom<C, T> method

Future<List<C>> getAColumnFrom<C, T>(
  1. String columnName, {
  2. String? afterWhere,
})

Returns every value of column columnName (typed as C) from the entity table T, optionally filtered by afterWhere.

Returns an empty list on error; the underlying error is logged with debugPrint to help debugging.

Implementation

Future<List<C>> getAColumnFrom<C, T>(
  String columnName, {
  String? afterWhere,
}) async {
  try {
    final List<Map<String, Object?>> rows =
        await getSomeColumnsFrom<T>(columnName, afterWhere: afterWhere);
    return rows
        .map((Map<String, Object?> row) => row[columnName] as C)
        .toList();
  } catch (e, s) {
    debugPrint('getAColumnFrom failed: $e\n$s');
    return <C>[];
  }
}