readMapFromTOMLSync function

Map<String, dynamic> readMapFromTOMLSync(
  1. String TOMLPath
)

Implementation

Map<String, dynamic> readMapFromTOMLSync(String TOMLPath) {
  File configFile = File(TOMLPath);
  if (configFile.existsSync()) {
    String contents = configFile.readAsStringSync();
    TomlDocument document = TomlDocument.parse(contents);
    return document.toMap();
  } else {
    throw Exception('File does not exist at path: $TOMLPath');
  }
}