Open liamappelbe opened 2 years ago
cc @brianquinlan
Cool, reading those annotations and generating version checking code is a cool idea!
platform.version
Isn't that the Dart version instead of the OS version?
Oops, yeah. Probably meant to use operatingSystemVersion
, but I don't think we want to try parsing that.
We're now parsing those API version annotations (#1403). So the only remaining issue is how do we get the OS version at runtime. Since a check like that is OS specific and requires native calls, it might make sense to add a native function to package:objective_c
to do this on iOS and macOS. If OS version getters are available on every mobile and desktop platform, and always returns an answer that fits in a semver, then we could instead add this to dart:ffi
or package:ffi
.
Not all APIs are available on all versions of iOS. There are annotations in Objective C for this, so we can turn that into version checks, and throw user friendly exceptions rather than crashing. Suggestion from Brian: