bestItem method

AppcastItem? bestItem()

Returns the latest item in the Appcast based on OS, OS version, and app version.

Implementation

AppcastItem? bestItem() {
  if (items == null) {
    return null;
  }

  AppcastItem? bestItem;
  items!.forEach((AppcastItem item) {
    if (item.hostSupportsItem(osVersion: osVersionString)) {
      if (bestItem == null ||
          Version.parse(item.versionString!) >
              Version.parse(bestItem!.versionString!)) {
        bestItem = item;
      }
    }
  });
  return bestItem;
}