readYamlMap function
Reads and returns a yaml file if exists and if the content is a map.
Implementation
Future<Map> readYamlMap(String filePath) async {
final document = await _readYamlFile(filePath);
if (document.contents is! YamlMap) {
throw DerryError(
type: ErrorCode.invalidYamlMap,
body: {
'path': filePath,
'content': document,
},
);
}
return document.contents.value as Map;
}