Add a pre-build script that uninstalls the default CocoaPods (gem uninstall cocoapods --all) and installs the exact version the lockfile needs (gem install cocoapods -v [version]), then runs pod install in the ios directory. Do this before the build step so the right version is active. Keep the pinned version in sync with the lockfile when you upgrade locally.

Context: Stack Overflow #56703333 (accepted answer, 3 votes): the Codemagic workflow ships an older CocoaPods than the Flutter project lockfile was generated with, producing version mismatch warnings and incompatibility issues. The accepted answer shows how to swap the version in a pre-build script.