keys property

Map<String, String> get keys

Get a map of all the context kinds and their keys.

An invalid context cannot be used to access a set of kinds and keys and an empty map will be returned.

The returned map is immutable.

Implementation

Map<String, String> get keys {
  if (!valid) {
    return {};
  }
  if (_keysMemo != null) {
    return _keysMemo!;
  }

  final kinds = attributesByKind.keys.toList(growable: false);
  final kindsAndKeys = <String, String>{};
  for (var kind in kinds) {
    kindsAndKeys[kind] = attributesByKind[kind]!.key;
  }
  _keysMemo = Map.unmodifiable(kindsAndKeys);
  return _keysMemo!;
}