При работе с пакетом SQFlite вы можете использовать query
или rawQuery
для выполнения этого, в обоих случаях вам нужно передать where arguments
как array
, а для distinct operator
это можно сделать следующим образом:
/// [GET] Get all the data by date using a query
getData(String date) async {
final db = await database;
final response = await db.query(
"TableExample",
distinct: true,
orderBy: 'id',
where: 'date = ?',
whereArgs: [date],
);
//...
}
/// [GET] Get all the data by date using a rawQuery
getDailyPollResponsesPerRangeDate(String date) async {
final db = await database;
final response = await db.rawQuery(
"SELECT DISTINCT TableExample.id, TableExample.date "
"FROM TableExample "
"WHERE TableExample.date == ? "
"ORDER BY TableExample.date DESC",
[date],
);
//...
}