toColumnMap method

Map<String, dynamic> toColumnMap()

Returns a single-level map that maps the column name to the value returned on that position. When multiple columns have the same name, the later may override the previous values.

Implementation

Map<String, dynamic> toColumnMap() {
  final map = <String, dynamic>{};
  for (final (i, col) in schema.columns.indexed) {
    if (col.columnName case final String name) {
      map[name] = this[i];
    } else {
      map['[$i]'] = this[i];
    }
  }
  return map;
}