mappedResultsQuery method Null safety

  1. @override
Future<List<Map<String, Map<String, dynamic>>>> mappedResultsQuery(
  1. String fmtString,
  2. {Map<String, dynamic>? substitutionValues = const {},
  3. bool? allowReuse,
  4. int? timeoutInSeconds}

Executes a query on this connection and returns each row as a Map.

This method constructs and executes a query in the same way as query, but returns each row as a Map.

(Note: this method will execute additional queries to resolve table names the first time a table is encountered. These table names are cached per instance of this type.)

Each row map contains key-value pairs for every table in the query. The value is a Map that contains key-value pairs for each column from that table. For example, consider the following query:

    SELECT, FROM employee;

This method would return the following structure:

      {"employee" : {"name": "Bob", "id": 1}}

The purpose of this nested structure is to disambiguate columns that have the same name in different tables. For example, consider a query with a SQL JOIN:

    SELECT,, FROM employee LEFT OUTER JOIN company ON;

Each returned Map would contain employee and company keys. The name key would be present in both inner maps.

      "employee": {"name": "Bob", "id": 1},
      "company: {"name": "stable|kernel"}


Future<List<Map<String, Map<String, dynamic>>>> mappedResultsQuery(
    String fmtString,
    {Map<String, dynamic>? substitutionValues = const {},
    bool? allowReuse,
    int? timeoutInSeconds}) async {
  final rs = await query(
    substitutionValues: substitutionValues,
    allowReuse: allowReuse ?? false,
    timeoutInSeconds: timeoutInSeconds,

  return => row.toTableColumnMap()).toList();