readFromFile function

Future<TreeNode> readFromFile (String fileName)

Read yaml from file

Implementation

Future<TreeNode> readFromFile(String fileName) async {
  AST tree = AST();
  File file = new File(fileName);
  String futureContent = await file.readAsString();
  List<String> arr = futureContent.split('\n');
  arr.forEach((f) {
    tree.addNode(f);
  });

  return tree.root;
}