operator [] method Null safety

dynamic operator [](
  1. dynamic index
)

Implementation

operator [](dynamic index) {
  if (index is int) {
    return index <= items.length ? items[index] : null;
  }

  if (index is String) {
    return items.firstWhereOrNull((item) => item.key == index);
  }
  return null;
}