Error Regarding undefined method `map' for nil:NilClass for Flutter App / CocoaPod Error

Viewed 30219

I'm having an error regarding my Flutter application. When I run the "flutter run" script in terminal, I'm getting the following error from Cocoapods: "Error output from CocoaPods: Searching for inspections failed: undefined method `map' for nil:NilClass" (as seen also by the attached picture). enter image description here

How do I go about solving this issue?

4 Answers

I was trying to run pod install command in ios folder. @boonyongyang solution is necessary but it seemed that I had 2 ffi's installed, so I had to also run it with arch -x86_64 command

sudo arch -x86_64 gem install ffi
# go to ios folder then run
arch -x86_64 pod install

I struggled for many hours to figure this out, none of the solutions from Stack Overflow worked. Finally, I found this note in official Flutter documentation:

Flutter's suggestion from official documentation

This problem arises on computers running on M1 chip. Just run the following code snippet in your terminal and everything works fine.

 sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc

On my MacBook M1 that issue came up when I accidentally added an blank line to the pubspec.yaml file. Deleting the line solved the issue (it looks like you can't have two empty lines one after another).

Related