element method

Node<Object?>? element(
  1. int offset
)

Returns the JSON array element at the offset if it exists, otherwise returns null. Negative offsets are supported.

Implementation

Node? element(int offset) {
  final v = value;
  if (v is List) {
    final index = offset < 0 ? v.length + offset : offset;
    if (index >= 0 && index < v.length) return _element(v, index);
  }
  return null;
}