How to remove flutter_facebook_auth packages from flutter app?

202 views Asked by At

I would like to remove the following sub-dependency packages from my flutter app, that are listed in my pubspec.lock file (not pubspec.yaml):

flutter_facebook_auth flutter_facebook_auth_platform_interface flutter_facebook_auth_web

My app does not use Facebook auth. It is not enabled as one of the sign-in providers in the Firebase console. It is also not listed as a provider:

FlutterFireUIAuth.configureProviders([ const EmailProviderConfiguration(), const GoogleProviderConfiguration(clientId: googleClientId), const AppleProviderConfiguration(), ]);

I understand they may be installed by default as part of the firebase_auth package. Is there any way to remove them?

When running the app, I had previously received warnings related to FacebookAutoLogAppEventsEnabled and FacebookAdvertiserIDCollectionEnabled, and I have set both to false in the Info.plist file. Unfortunately, I still get those 3 facebook packages when running pod install or pod update.

I have already tried running flutter clean as well as deleting the podfile.lock file in the ios folder.

Much appreciated.

3

There are 3 answers

1
AudioBubble On

here it says you need to install facebook plugin separately.

try

$ flutter pub cache repair

$ flutter clean

$ flutter pub get
4
ankushlokhande On

Follow these steps to remove the packages from the project:

Step 1: Navigate to pubspec.yaml in your project root directory.

Step 2: Remove the package name that you want to remove from the project.

This section typically looks like this:

dependencies:
  flutter:
    sdk: flutter
  package_name_to_remove: ^x.y.z
  ...

Step 3: Now run the following command:

flutter clean
flutter pub get

It applied on the Android project (by default)

For iOS build (need additional work):

  • Ensure that you have set the FacebookAutoLogAppEventsEnabled and FacebookAdvertiserIDCollectionEnabled to false in your Info.plist file. It's important to disable these settings to avoid Facebook-related warnings.

  • Delete Pods: Delete the Pods folder and the Podfile.lock file in the ios directory of your Flutter project.

  • Reinstall Pods: Run pod install in the iOS directory of your Flutter project to update the iOS dependencies:

cd ios
pod install
2
Roslan Amir On

There is a Flutter command to remove packages:

dart pub remove <package1> [<package2>...]

or

flutter pub remove <package1> [<package2>...]

You must be in the directory where your pubspec.yaml is.