readAsYaml<T extends dynamic> method
Future<T>
readAsYaml<
T extends dynamic>({ - T constructor(
- Map<String, dynamic> payload
)?,
})
Implementation
Future<T> readAsYaml<T extends dynamic>(
{T Function(Map<String, dynamic> payload)? constructor}) async {
final stringifyContent = await readAsString();
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;
}