INNER CODE UNIT · Dart
RegistryOrderMap
foxsofter/flutter_thrio · lib/src/collection/registry_order_map.dart:25
class RegistryOrderMap<K, V> {
final _list = <MapEntry<K, V>>[];
VoidCallback registry(K key, V value) {
assert(key != null, 'key must not be null.');
assert(value != null, 'value must not be null.');
final item = MapEntry(key, value);
_list.add(item);
return () {
_list.remove(item);
};
}
int get length => _list.length;
MapEntry<K, V> elementAt(int index) => _list.elementAt(index);
Iterable<K> get keys => _list.map((it) => it.key);