getAColumnFromWithTableName<T> method
Like getAColumnFrom but accepts an arbitrary table name (or a join
expression). Useful for querying non-entity tables such as
sqlite_master or to run joined queries with table aliases.
Example:
final names = await DataAccess.instance
.getAColumnFromWithTableName<String>(
'c.name',
'Custom c, Profile p',
afterWhere: "c.profile = p.id AND p.name = 'faithful'",
);
Implementation
Future<List<T>> getAColumnFromWithTableName<T>(
String columnName,
String table, {
String? afterWhere,
}) async {
try {
final List<Map<String, Object?>> rows =
await getSommeColumnsWithTableName(
columnName,
table,
afterWhere: afterWhere,
);
return rows
.map((Map<String, Object?> row) => row[columnName] as T)
.toList();
} catch (e, s) {
debugPrint('getAColumnFromWithTableName failed: $e\n$s');
return <T>[];
}
}