loadFile static method

Future<Map<String, dynamic>?> loadFile(
  1. File plist
)

Parses any XML property list file (e.g. PrivacyInfo.xcprivacy). Returns null if the file is missing or is not a valid XML plist.

Implementation

static Future<Map<String, dynamic>?> loadFile(File plist) async {
  if (!await plist.exists()) {
    return null;
  }

  final XmlDocument document;
  try {
    document = XmlDocument.parse(await plist.readAsString());
  } catch (_) {
    return null;
  }

  final rootDict = document.rootElement.getElement('dict');

  if (rootDict == null) {
    return null;
  }

  return _parseDict(rootDict);
}