'how to work with firebase with nullsafety on m1?

EDIT : solved at this time, just using the latest version

i have test with latest version of firebase. and i got this CocoaPods could not find compatible versions for pod "Firebase/Firestore":

  # nullsafety # not work #solved
  firebase_core: ^1.5.0   #solved now ^1.6.0
  firebase_auth: ^3.0.2   #solved now ^3.1.0
  cloud_firestore: ^2.5.0 #solved now ^2.5.1
                          #solved now firebase_storage: ^10.0.3

  # non nullsafety # work
  # firebase_core: ^0.4.0+9
  # firebase_auth: ^0.14.0+5
  # cloud_firestore: ^0.12.9+5

my engine :

  1. ➜ ios git:(master) ✗ ruby --version ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
  2. ➜ ios git:(master) ✗ gem --version 3.0.3

i have tried with these step

➜  flash-chat-flutter git:(master) ✗ flutter clean
Cleaning Xcode workspace...                                         4.4s
....
➜  ios git:(master) ✗ pod cache clean --all
➜  ios git:(master) ✗ pod deintegrate
Deintegrating `Runner.xcodeproj`
Deleted 1 'Check Pods Manifest.lock' build phases.
....
Deleted 1 empty `Frameworks` groups from project.
Removing `Pods` directory.

Project has been deintegrated. No traces of CocoaPods left in project.
Note: The workspace referencing the Pods project still remains.
➜  ios git:(master) ✗ sudo arch -x86_64 gem install ffi
Password:
Building native extensions. This could take a while...
Successfully installed ffi-1.15.3
Parsing documentation for ffi-1.15.3
Done installing documentation for ffi after 3 seconds
1 gem installed
➜  ios git:(master) ✗ sudo gem install cocoapods --pre
....
Fetching xcodeproj-1.21.0.gem
....
Successfully installed cocoapods-1.11.0.rc.1
Parsing documentation for addressable-2.8.0
Installing ri documentation for addressable-2.8.0
....
Done installing documentation for addressable, cocoapods-core, molinillo, xcodeproj, cocoapods after 2 seconds
5 gems installed

i got problem on these step ...

➜  ios git:(master) ✗ arch -x86_64 pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "cloud_firestore":
  In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)

Specs satisfying the `cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)` dependency were found, but they required a higher minimum deployment target.

[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
➜  ios git:(master) ✗ arch -x86_64 pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "Firebase/Firestore":
  In snapshot (Podfile.lock):
    Firebase/Firestore (= 6.34.0, ~> 6.0)

  In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 2.5.0, which depends on
      Firebase/Firestore (= 8.5.0)


You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * changed the constraints of dependency `Firebase/Firestore` inside your development pod `cloud_firestore`.
   You should run `pod update Firebase/Firestore` to apply changes you've made.

[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

also i have following these step and work with non nullsafety only Running CocoaPods on Apple Silicon (M1)



Solution 1:[1]

Well, I am by no means an expert on M1, but after much struggling getting iOS and Android builds to work with Flutter, here some decisive moments I can share:

  • Realising that Rosetta is needed, even though on a Silicon chip (I installed it along with the Xcode installation).

  • sudo arch -x86_64 gem install ffi and sudo arch -x86_64 gem install cocoapods worked for me...no need to install from a Rosetta terminal. Google "gem list --local | grep cocoapods" if you need to clean up existing installation.

  • Regarding Android. Installed Arctic Fox (2020.3.1) and even though this also includes java, I found that I had to install java as well. I installed java from Oracle (version 11 (11.0.12), same as Arctic Fox use).

  • Finding out that iOS build only works on the Flutter beta channel (Flutter 2.5.0-5.2.pre at the time of writing).

  • Realising that adding or removing packages from pubspec.yaml can f#*k up a working setup. Even a Flutter clean will not set things straight when that happens. Found out that just dumping my project folder, and just reloading source files using git will make things work again (I make sure not to include any pod related files in my git).

  • Finding out that Firebase packages require iOS 10 or higher. I opened the Runner.xcworkspace in Xcode and set the iOS deployment target to 10.

At one point everything worked, but at the moment the iOS simulator does not work. iOS only work on my iPad via usb.

The Firebase versions working in my setup:

  • firebase_core: ^1.4.0
  • firebase_storage: ^10.0.1
  • cloud_firestore: ^2.4.0
  • firebase_auth: ^3.0.2

Solution 2:[2]

Go to ios/pods/Local Podspaces on your project.

Then check all the .json file there to locate the last version in my case was "ios": "10.0" .

Then go to ios/Podfile and uncomment the version on the top

platform :ios, '9.0'

and change it to the last version, in my case is:

platform :ios, '10.0'

See cocoapods version flutter

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lbor
Solution 2 Faisal Hani