resolveVersionedForDarwin function
Permission
resolveVersionedForDarwin(
- Permission permission,
- bool isRegistered(
- Type permissionType
Resolves a VersionedPermission for Darwin platforms.
iOS/macOS variants do not rely on API level checks in the same way Android does, so this chooses the first variant that is actually registered for the current platform. If none are registered, the original versioned permission is returned so the caller can classify it as unsupported.
Implementation
Permission resolveVersionedForDarwin(
Permission permission,
bool Function(Type permissionType) isRegistered,
) {
if (permission is! VersionedPermission) return permission;
for (final variant in permission.variants) {
if (isRegistered(variant.permission.runtimeType)) {
return variant.permission;
}
}
return permission;
}