iosMajorVersion top-level property

int? get iosMajorVersion

The device's iOS major version (e.g. 26 for "Version 26.0 (Build ...)"), or null if not on iOS or the version string can't be parsed.

Implementation

int? get iosMajorVersion {
  if (!Platform.isIOS) return null;
  final match = RegExp(r'\d+').firstMatch(Platform.operatingSystemVersion);
  return match == null ? null : int.tryParse(match.group(0)!);
}