isMacOS static method

bool isMacOS(
  1. String appVersion,
  2. String platform,
  3. int maxTouchPoints
)

Whether the given navigator values identify a macOS browser.

Chrome and Safari report an appVersion containing Mac OS (e.g. 5.0 (Macintosh; Intel Mac OS X 10_15_7) ...), while Firefox reports only 5.0 (Macintosh), so both tokens are checked, with a Mac-prefixed platform (such as MacIntel) as a fallback. iPads masquerading as macOS are excluded through isIOS.

Implementation

static bool isMacOS(String appVersion, String platform, int maxTouchPoints) {
  return (appVersion.contains('Mac OS') ||
          appVersion.contains('Macintosh') ||
          platform.contains('Mac')) &&
      !isIOS(platform, maxTouchPoints);
}