toTableColumnMap method
Returns a two-level map that on the first level contains the resolved non-aliased table name, and on the second level the column name (or its alias).
A table name (first level map key) is null when the column is not directly associated with a table, such as a computed column. The map is null if the sqlite3 library was not compiled with the SQLITE_ENABLE_COLUMN_METADATA C-preprocessor symbol. More information in https://www.sqlite.org/c3ref/column_database_name.html.
Implementation
Map<String?, Map<String, dynamic>>? toTableColumnMap() {
if (_result.tableNames == null) {
return null;
}
final Map<String?, Map<String, dynamic>> map = {};
for (int i = 0; i < _data.length; i++) {
final tableName = _result.tableNames![i];
final columnName = _result.columnNames[i];
final value = _data[i];
final columnsMap = map.putIfAbsent(tableName, () => <String, dynamic>{});
columnsMap[columnName] = value;
}
return map;
}