Here is the full set of steps that solved the problem for me:
# Delete old build artifacts
rm -rf build
rm -rf ios/build
# Regenerate iOS-related files
flutter precache --ios
flutter pub get
# Rebuild (codesigning disabled)
flutter build ios --no-codesign
Eventually I discovered that the project could successfully build in Android Studio, and after that Xcode was also able to build it without errors.