0

I created a flutter project and a Podfile was generated automatically. I need to add the following dependencies into my project,

pod 'GMGdtAdapter-Beta', '4.15.40.1'
pod 'GMKsAdapter-Beta', '3.3.76.1'

May I ask if I should add these two lines at the end of the auto-generated Profile? like

... ...

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

pod 'GMGdtAdapter-Beta', '4.15.40.1'
pod 'GMKsAdapter-Beta', '3.3.76.1'

Or if I should add them in the Runner target like,

... ...

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  pod 'GMGdtAdapter-Beta', '4.15.40.1'
  pod 'GMKsAdapter-Beta', '3.3.76.1'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

... ...

Thanks in advance!

1 Answer 1

0

The short answer is: You should add it inside Runner target.

---------------

To manually add a CocoaPods dependency to an iOS Flutter project, follow these steps:

✅ 1. Open your iOS Podfile

In your Flutter project, navigate to:

your_flutter_project/ios/Podfile

✅ 2. Add your Pod inside the target 'Runner' do block

For example, to add SDWebImage:

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  # Add your pod here
  pod 'SDWebImage', '~> 5.0'
end

✅ 3. Run pod install

After saving the Podfile:

cd ios
pod install

✅ 4. (Optional) Clean and rebuild

Sometimes it's useful to clean and rebuild your Flutter project:

flutter clean
flutter pub get
flutter run

⚠️ Notes

  • Flutter uses CocoaPods internally, so you must not remove or modify flutter_install_all_ios_pods.

  • If your pod uses use_frameworks!, you may need to resolve conflicts if some Flutter plugins are incompatible. You can use workarounds like :modular_headers => true or convert to static frameworks depending on the case.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much, siega!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.