readAsYamlSync<T extends dynamic> method
T
readAsYamlSync<
T extends dynamic>({ - T constructor(
- Map<String, dynamic> payload
)?,
})
Implementation
T readAsYamlSync<T extends dynamic>(
{T Function(Map<String, dynamic> payload)? constructor}) {
final stringifyContent = readAsStringSync();
final YamlMap yamlContent = loadYaml(stringifyContent);
final Map<String, dynamic> map = {};
for (final entry in yamlContent.entries) {
map[entry.key.toString()] = entry.value;
}
return constructor != null ? constructor(map) : map;
}