getRootFilePath method

Future<String> getRootFilePath(
  1. Fetcher fetcher
)

Implementation

Future<String> getRootFilePath(Fetcher fetcher) async {
  String? path = (await fetcher.readAsXmlOrNull("/META-INF/container.xml"))
      ?.firstElementChild
      ?.getElement("rootfiles", namespace: Namespaces.opc)
      ?.getElement("rootfile", namespace: Namespaces.opc)
      ?.getAttribute("full-path");
  if (path == null) {
    throw Exception("Unable to find an OPF file.");
  }
  return path;
}