indexOfKey method

  1. @override
int indexOfKey(
  1. K key, [
  2. int start = 0
])
override

The first index of key in this list.

Searches the list from index start to the end of the list. The first time an object o is encountered so that o == element, the index of o is returned.

Returns -1 if the key is not found.

Implementation

@override
int indexOfKey(K key, [int start = 0]) {
  final Map<K, V> map = _map;

  if (map is ListMap<K, V>)
    return map.indexOfKey(key, start);
  else {
    int count = 0;
    for (K _key in _map.keys) {
      if (count >= start && key == _key) return count;
      count++;
    }
    return -1;
  }
}