I am trying to rewrite my code to make is null safety.
PostgreSQLResult getResultFromCache(sqlQuery) {
for (var req in requestsCacheList) {
if(req.requestHash == sqlQuery.hashCode) {
return req.requestResult;
}
}
// var p = PostgreSQLResult(); // what should be here? Implementing PostgreSQLResult?
// return p;
}
I should to return here PostgreSQLResult
instead of null
. I looked sources what PostgreSQLResult
is:
/// A single row of a query result.
///
/// Column values can be accessed through the `[]` operator.
abstract class PostgreSQLResultRow implements List {
List<ColumnDescription> get columnDescriptions;
/// Returns a two-level map that on the first level contains the resolved
/// table name, and on the second level the column name (or its alias).
Map<String, Map<String, dynamic>> toTableColumnMap();
/// Returns a single-level map that maps the column name (or its alias) to the
/// value returned on that position.
Map<String, dynamic> toColumnMap();
}
/// The query result.
///
/// Rows can be accessed through the `[]` operator.
abstract class PostgreSQLResult implements List<PostgreSQLResultRow> {
/// How many rows did this query affect?
int get affectedRowCount;
List<ColumnDescription> get columnDescriptions;
}
Could you show me how should be look empty result PostgreSQLResult
set?