readMapFromTOMLAsync function
Implementation
Future<Map<String, dynamic>> readMapFromTOMLAsync(String TOMLPath) async {
File configFile = File(TOMLPath);
if (await configFile.exists()) {
String contents = await configFile.readAsString();
TomlDocument document = TomlDocument.parse(contents);
return document.toMap();
} else {
throw Exception('File does not exist at path: $TOMLPath');
}
}