yamlMapToDartMap function

Map<String, Object> yamlMapToDartMap(
  1. YamlMap yaml
)

Implementation

Map<String, Object> yamlMapToDartMap(YamlMap yaml) {
  bool isString(YamlScalar key) => key.value is String;
  MapEntry<String, Object> toEntry(YamlScalar key) => MapEntry(
        key.value as String,
        yamlNodeToDartObject(yaml.nodes[key]),
      );

  final map = Map<String, Object>.fromEntries(yaml.nodes.keys.whereType<YamlScalar>().where(isString).map(toEntry));
  return Map.unmodifiable(map);
}