When adding a dependency with Swift Package Manager in Xcode for a Flutter project, your build fails with this error message:
xcodebuild: error: Could not resolve package dependencies: Packages are not supported when using legacy build locations, but the current project has them enabled. Command: /usr/bin/xcodebuild -list
Close your workspace in Xcode.
.xcodeprojfile INSTEAD of the
.xcworkspacefile (most likely /yourApp/ios/Runner.xcodeproj).
When the project is open, in the Xcode menu bar click File -> Project Settings -> Advanced.
Change the option from LEGACY to XCODE DEFAULT.
.xcworkspaceagain and it should work!