rowToMap method
Build a column-name -> value view of row. Both bare and table.col
keys are populated so qualified expressions resolve.
Implementation
Map<String, Object?> rowToMap(List<Object?> row, {String? alias}) {
// Cache the bare + qualified key strings; rebuilt only when the
// table is renamed or the column list changes (those paths set
// [_keysName] back to null).
if (_keysName != name || _keysCount != columns.length) {
_keysBare = [for (final c in columns) c.name];
_keysQualified = [for (final c in columns) '$name.${c.name}'];
_keysName = name;
_keysCount = columns.length;
}
final m = <String, Object?>{};
final n = columns.length;
for (var i = 0; i < n; i++) {
m[_keysBare![i]] = row[i];
m[_keysQualified![i]] = row[i];
}
if (alias != null) {
for (var i = 0; i < n; i++) {
m['$alias.${_keysBare![i]}'] = row[i];
}
}
return m;
}