This is how I did it:
Navigate to the /ios folder within your project.
Delete the Podfile.lock file located at Your Project/ios/Podfile.lock.
Open the command prompt and execute the command pod repo remove trunk.
This will remove the pod repository.
To completely remove the pod, run the appropriate command based on your Mac chip:
For Intel chip users:
Run pod install --repo-update.
Make sure you are in the iOS directory of your Flutter app (use cd command to navigate).
For M1 or M2 chip users which would be your case:
If not already installed, run sudo arch -x86_64 gem install ffi in a regular terminal to install ffi.
Then execute arch -x86_64 pod install --repo-update.
If you encounter an error regarding the compatibility of the cloud_firestore pod, do the following:
Open the Podfile and locate the line that starts with platform :ios.
Uncomment the line and set the minimum deployment target to '12.0' (or a higher version if needed).
It should look like: platform :ios, '12.0'.
Run arch -x86_64 pod install --repo-update again.
This time, the installation should work fine.
Clean the Flutter project by running flutter clean.
Finally, execute flutter run to run your project.