yamlToJson function

Future<Map<String, String>> yamlToJson (dynamic fileName)

Implementation

Future<Map<String, String>> yamlToJson(fileName) async {
  File yaml = new File(fileName);
  Map<String, String> data = new Map();

  Stream<List<int>> inputStream = yaml.openRead();

  inputStream.transform(utf8.decoder).transform(new LineSplitter()).listen(
      (String line) {
    data[line.split(":")[0]] = line.split(":")[1];
  }, onDone: () {
    print(data);
    return data;
  }, onError: (e) {
    return {};
  });
}