queryList<T> method
Executes a SQLite query that may return multiple values.
Implementation
Future<List<T>> queryList<T>(
final String sql, {
final List<Object>? arguments,
required final T Function(Map<String, Object?>) mapper,
}) async {
final rootNode = _parseRootNode(sql);
if (rootNode is SelectStatement) {
return _database
.rawQuery(sql, arguments)
.then((rows) => rows.map((row) => mapper(row)).toList());
} else {
throw StateError(
'Unsupported query "$sql" for List return type. It should be SELECT, since DELETE, UPDATE, INSERT returns `int` type.');
}
}