operator [] method

  1. @override
dynamic operator [](
  1. Object? key
)
override

Dual-mode access: integer index for positional, string for header-based.

Returns null if a string key has no matching header or is out of bounds.

Implementation

@override
dynamic operator [](Object? key) {
  if (key is int) return _fields[key];
  if (key is String) {
    final idx = _headerMap?[key];
    if (idx != null && idx < _fields.length) return _fields[idx];
  }
  return null;
}