parseFile function

Future<Map<String, dynamic>> parseFile(
  1. File guraFile, {
  2. Map<String, String>? env,
})

Parses the contents of the given File following the Gura configuration format, asynchronously.

Can be given an optional Map<String, String> env named argument containing key/value pairs to inject into the parser's environment variable snapshot for use within the file to be parsed.

Returns a Future<Map<String, dynamic>> containing all key/value pairs from the parsed Gura input.

Example:

File guraFile = File("foo_bar.ura");
Map<String, dynamic> gura = await parseFile(guraFile, env: { 'foo': 'bar' });

Note: If a key in the given env Map already exists in the parser's env snapshot, it will be overwritten with the given Map's key/value

Implementation

Future<Map<String, dynamic>> parseFile(File guraFile, {Map<String, String>? env}) async
{
	final String fileContents = await guraFile.readAsString();
	return parse(fileContents, env: env);
}