fields function
Runtime field selection deliberately returns dynamic values.
Captures the selected names and projections now and builds a map for each decoded row. Use a scalar or Record selection when result fields are known statically and their individual Dart types should be preserved.
Implementation
Selection<Map<String, Object?>> fields(
Map<String, Selection<Object?>> selected,
) {
final entries = selected.entries.toList(growable: false);
return _Combined(
[for (final e in entries) e.value],
(read) =>
(row) => {
for (var i = 0; i < entries.length; i++) entries[i].key: read[i](row),
},
);
}