Module 'cloud_firestore' not found in release mode

I tried to run my Flutter app in Xcode in release mode, but I got the error: module 'cloud_firestore' not found. When I run my app in debug mode, everything works as expected. I also uploaded my app to the App Store for TestFlight and when I download it there it crashes, but only after I log in with Firebase Authentication.

I have verified that the platform: iOS version in the pod file matches the deployment info in Xcode and I have verified that I have runner.xcworkspace open. I have also tried - delete Podfile - 'flutter clean' - 'flutter pub get' - 'flutter build ios'

But I still get the error and I think this is the problem why my app crashes on the TestFlight. I am not using the latest version of Xcode, could this be a problem?

What else can I do?