<Updated 11/20>
I remove the destination device
Apple Vision Pro (designed for iPad)
and add Apple Vision
which SDK is visionOS
, then I click Build and the project show No such module 'Flutter'. That is also the right result due to Flutter currently not support visionOS?
===
I try to do Isolate features that are unavailable in visionOS with my code in Flutter, and I wrote a Flutter plugin to check if os is visionOS:
#if os(visionOS)
return true
#elseif os(iOS)
return false
#else
return false
#endif
I run flutter run
to run my app in the iOS simulator for Flutter building the iOS native code. After that, I open Xcode beta and run the "runner" project in "Apple Vision Pro (designed for iPad)" simulator.
But it always runs into the line #elseif os(iOS)
Which step did I go wrong?
You haven't done anything wrong; that's the correct behavior.
"Apple Vision Pro (designed for iPad)"
is a mode where apps built for iOS are being run as-is on visionOS.os(visionOS)
will only be true if you build against the visionOS SDK instead, which is not currently possible with Flutter (unless you build a custom Flutter engine against visionOS and modify theflutter
tool locally).The page you linked to is specifically about building against the visionOS SDK rather than running apps built against the iOS SDK on visionOS, so isn't currently relevant for Flutter.