Remove firebase from flutter project

To remove Firebase from a Flutter project, you need to perform the following steps:

  1. Remove Firebase dependencies from pubspec.yaml file:

  2. dependencies:
      flutter:
        sdk: flutter
      firebase_core: ^1.7.0
      firebase_auth: ^3.3.0
      cloud_firestore: ^3.1.0
      firebase_messaging: ^11.2.2
      firebase_analytics: ^10.2.0
      firebase_crashlytics: ^2.5.6
      firebase_performance: ^3.3.0

    Remove the above Firebase dependencies from the pubspec.yaml file.

  3. Run the command:

  4. flutter pub get

  5. Remove the Firebase configuration files:
  6. Inside the android/app directory, delete the google-services.json file.

    Inside the ios/Runner directory, delete the GoogleService-Info.plist file.

  7. Remove Firebase initialization code:
  8. Open the lib/main.dart file and remove the Firebase initialization code, which typically looks like this:


    import 'package:firebase_core/firebase_core.dart';

    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      await Firebase.initializeApp();
      runApp(MyApp());
    }

    Remove the above code block from the main() function.

  9. Clean the project:
  10. Run the command:


    flutter clean

  11. Build and run the project:
  12. Finally, build and run your project using the command:


    flutter run

After completing these steps, Firebase should be removed from your Flutter project.

Same cateogry post

Leave a comment